-- ALTER TABLE erp1.accountmovement AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.accountmovementkind AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.accountstree AUTO_INCREMENT = 420;
-- ALTER TABLE erp1.accountstreefromprog AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.accountstreesetting AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.ads AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.area AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.assets AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.assetscat AUTO_INCREMENT = 25;
-- ALTER TABLE erp1.assetssale AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.availableparcode AUTO_INCREMENT = 100001;
-- ALTER TABLE erp1.bank AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.bankaccount AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.beneficiaries AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.beneficiaries_eco AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.beneficiaries_family AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billname AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.billoperation AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billprint AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billprinter AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billproperty AUTO_INCREMENT = 130;
-- ALTER TABLE erp1.bills AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billsbuy AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billsettings AUTO_INCREMENT = 1196;
-- ALTER TABLE erp1.billsproducts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billsproductsbuy AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billsreturn AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billsreturnproducts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billtemplate AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.billtemplatedetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.bind AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.bindsettlement AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.boarding AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.branch AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buyandruternbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buyandruternbillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buyandruternbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buybill AUTO_INCREMENT = 27;
-- ALTER TABLE erp1.buybillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buybilldetail AUTO_INCREMENT = 27;
-- ALTER TABLE erp1.buybilldetailoffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buybilloffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buypriceshistorybook AUTO_INCREMENT = 26;
-- ALTER TABLE erp1.capital AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.carfile AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.carreview AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.carreviewer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.cars AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.cartracking AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.cashtransfer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.charities AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.charitiescenter AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.charitysearchlog AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.checkcontroller AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.checkdeposit AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.checkwithdrawal AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claimdebts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claimreturnsellbills AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claims AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claimsclientbills AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claimsellbills AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.claimstypeclients AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.client AUTO_INCREMENT = 3;
-- ALTER TABLE erp1.clientarea AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.clientdebtchange AUTO_INCREMENT = 31;
-- ALTER TABLE erp1.clientdetails AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.clientpaymentreceiptt AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.clientproductreview AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.clinic AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.collectedparcodestemp AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.commentclient AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.costcenter AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.costcenterdetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.country AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.coupons AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.currency AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.dailyentry AUTO_INCREMENT = 51;
-- ALTER TABLE erp1.dailyentrycreditor AUTO_INCREMENT = 51;
-- ALTER TABLE erp1.dailyentrydebtor AUTO_INCREMENT = 51;
-- ALTER TABLE erp1.damagedproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.datedchecked AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.discountcontrol AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.disease AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.doctorkashf AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.dollarearnings AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.ebillsetting AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.eclientsetting AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employee AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeattendance AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeattendancesystem AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeattendancesystemweek AUTO_INCREMENT = 8;
-- ALTER TABLE erp1.employeeclosedaygroupstatus AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeclosedayhistory AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeclosedaystatus AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeeclosedaysubgroupstatus AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeedoctor AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeedoctordebtandpay AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeedoctordebtchange AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeegroup AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeepersonnel AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.employeesubgroup AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.entryproductspurchased AUTO_INCREMENT = 26;
-- ALTER TABLE erp1.expenseexchange AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.expenses AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.expensestype AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.faida AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.faidadirector AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.faidaproduct AUTO_INCREMENT = 3;
-- ALTER TABLE erp1.goverarea AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.government AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.importcontract AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.impotencetreatmentsuppliersave AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.income AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.incometype AUTO_INCREMENT = 8;
-- ALTER TABLE erp1.insurancecompanies AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.kashf AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.kempiala AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.knownways AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.languages AUTO_INCREMENT = 3;
-- ALTER TABLE erp1.lastbillidspricesupdated AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.lastbillidsquickprofit AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_check AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_comreceipt AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_comreceiptdetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_comreceiptimage AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_externalmaintenance AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_finishingpayed AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_handedreport AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_initialmaintenance AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_initialmaintenancedetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_insurance AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_maintenancereceipt AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_maintenancereceiptfinish AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_producthistory AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_stage AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.m_stageproperity AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maccontrol AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenancecases AUTO_INCREMENT = 5;
-- ALTER TABLE erp1.maintenancecenters AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenancecomments AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenancecompanies AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenancepolicys AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenanceprocedures AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.maintenances AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.manufacuresetting AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.menuurl AUTO_INCREMENT = 31;
-- ALTER TABLE erp1.movementmanage AUTO_INCREMENT = 430;
-- ALTER TABLE erp1.movementmanagedeleted AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.newdbbackup AUTO_INCREMENT = 3;
-- ALTER TABLE erp1.newdbname AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.notics AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.offerpricebill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.offerpricebillprop AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.offerpricecondition AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinecat AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlineproductcat AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinestoresetting AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.onlinetempcategory AUTO_INCREMENT = 5;
-- ALTER TABLE erp1.onlinetemporder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinetemporderclient AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinetemporderproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinetempproduct AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.onlinetempstoredetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.onlinetempstorereport AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.otherrequest AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.otherstoremovement AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.pages AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.partner AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.partnertransferbetween AUTO_INCREMENT = 25;
-- ALTER TABLE erp1.partnerwithdrawal AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.paymentnetworks AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.playstationcard AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.playstationclientcard AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.playstationclientcardpayhistory AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.policy AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.premium AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.premiumautomatic AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.premiumclient AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.premiuminstallments AUTO_INCREMENT = 24;
-- ALTER TABLE erp1.product AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.productcat AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.productcatunit AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.productingredients AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionexecution AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionexecutionoutput AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionexecutionproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionexecutionwaste AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionorder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionout AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionoutdetails AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionoutmany AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionoutmanyinproducts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionoutmanyoutproducts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionrate AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productionrateproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productrecieve AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productrequests AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productserial AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productsetting AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productstore AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.producttemp AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.producttempunit AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.productunit AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.programsettings AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.project AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.projectexchmaterial AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.projectexchmaterialdetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.projectexchmaterialdetailreturn AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.projectexchmaterialreturn AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.projectkind AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.properties AUTO_INCREMENT = 688;
-- ALTER TABLE erp1.qrerpuserpass AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.quickprofitclient AUTO_INCREMENT = 23;
-- ALTER TABLE erp1.quickprofitday AUTO_INCREMENT = 23;
-- ALTER TABLE erp1.quickprofitgeneral AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.quickprofitproduct AUTO_INCREMENT = 30;
-- ALTER TABLE erp1.quickprofitstore AUTO_INCREMENT = 30;
-- ALTER TABLE erp1.religions AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.relusergroupproperties AUTO_INCREMENT = 3224;
-- ALTER TABLE erp1.rentbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.rentbillprop AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.rentproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.rentstore AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.representativecompany AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restauranthall AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantkitchenprint AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantorder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantorderdeliverydetails AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantorderdetails AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantplaystation AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantplaystationplay AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantprinter AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restaurantrawdestruction AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.restauranttable AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.resturantcategory AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.returnbuybill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnbuybillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnbuybilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnsellbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnsellbillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnsellbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.returnsellbillreview AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.richproperity AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.salaryreport AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.saudielectronicinvoice AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.save AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.saveclose AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.savedaily AUTO_INCREMENT = 26;
-- ALTER TABLE erp1.savestock AUTO_INCREMENT = 5;
-- ALTER TABLE erp1.savetype AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.searchfilters AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellandruternbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbill AUTO_INCREMENT = 29;
-- ALTER TABLE erp1.sellbillandreturnreview AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillandrutern AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillandruterncurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbilldetail AUTO_INCREMENT = 33;
-- ALTER TABLE erp1.sellbilldetailoffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbilldetailorder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbilldetailtax AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillimage AUTO_INCREMENT = 9;
-- ALTER TABLE erp1.sellbilloffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillorder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillpayed AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillreview AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sellbillstatus AUTO_INCREMENT = 26;
-- ALTER TABLE erp1.sellbillview AUTO_INCREMENT = ;
-- ALTER TABLE erp1.settingoperation AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.shippercompanies AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.shippingfile AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.simplemanufacturesetting AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.sizecolor AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sizecolorstoredetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sliders AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.soldserialproduct AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sparepart AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sparepartstore AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.sparepartstoredetails AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.sparepartstorereport AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.stage AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.stagestep AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.stock_import_logs AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.store AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.storedetail AUTO_INCREMENT = 7;
-- ALTER TABLE erp1.storemovement AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.storemovement_main AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.storereport AUTO_INCREMENT = 60;
-- ALTER TABLE erp1.studentabsences AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentaddsubjectdetails AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentaddsubjects AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.students AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsetting AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsexams AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsexamsval AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentspaymentsystems AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentspays AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsubjectgroupdays AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsubjectgroups AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.studentsubjects AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.subvention AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.subventionpay AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.suppay AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.supplier AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.supplierdebtchange AUTO_INCREMENT = 23;
-- ALTER TABLE erp1.supplieropen AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.supplieropendebtchange AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.supplieropenexchangeorclosing AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.tamweenbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.tamweenclientdetail AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.tamweenda3mstatus AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.tamweenremainstatus AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.taskorder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.taskorderproducts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.taskscases AUTO_INCREMENT = 6;
-- ALTER TABLE erp1.temreturnsellbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.temreturnsellbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.temsellandruternbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.temsellbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.temsellbillandrutern AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.temsellbilldetail AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.toworkshoporder AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.toworkshoporderbill AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.transferbtweenbankaccount AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.transferclientaccounts AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.transfermoney AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.typeclient AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.typesimpotencetreatment AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.typesupplier AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.unit AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.user AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.usergroup AUTO_INCREMENT = 5;
-- ALTER TABLE erp1.usergroupadmin AUTO_INCREMENT = 1029;
-- ALTER TABLE erp1.vatpayment AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.wishlist AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.workshop AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.workstation AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.workstationassets AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.workstationworker AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.youtube_link AUTO_INCREMENT = 290;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:32:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE programsettings SET companyname = 'GT4', address = 'القاهرة - المقطم - شارع 9 ', specializtion = 'برمجيات - مواقع انترنت - تطبيقات موبايل', phone = '0111007088', faxnumber = '', email = 'mousa_maged@hotmail.com', website = '', logo = '3f52022081b9a1a89c6f3246463c2d62.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 = '123456789123', commercialregistration = '1234', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2025-12-22',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 = '1' ,isRestaurent = '1' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='44a31748dcc9eba74d9b43424c373ad9140cf58047d859719ce4980e548afbebe140fa05fac50dce2c3d75d470ba3f1fdb7cf6a07a52b3cb3685408882a88dc2',associatedtags='0',commentClientChasis='0',dollarExType='1',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0' WHERE programsettingsid = '1';
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE programsettings SET companyname = 'GT4', address = 'القاهرة - المقطم - شارع 9 ', specializtion = 'برمجيات - مواقع انترنت - تطبيقات موبايل', phone = '0111007088', faxnumber = '', email = 'mousa_maged@hotmail.com', website = '', logo = '3f52022081b9a1a89c6f3246463c2d62.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 = '123456789123', commercialregistration = '1234', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '1', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2025-12-22',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 = '1' ,isRestaurent = '1' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='0',addclienttoproduct='0',closingcustomeraccount='0',serial2='',
                shownameE='0',showprocode='0',showpartnumber='0',showtype='0',showcompany='0',showweight='0',showorigin='0',showhscode='0',showexpire='0',showgrantduration='0',showonline='0',showminappear='0',showonlinecat='0',showsellpercentage='0',showbuydiscount='0',preparingStore='1',sellordername='0',showsearchfilter='0',unitPriceAtsalesreport='0',medExCat='0',laterNakdiClientId='0',headerPrint12Right='',headerPrint12Left='',halfPriceStart='0',allPriceStart='0',checkretsellclient='1',webApiId='0',noBillEditTillPay='0',showDataOfficialContract='0',showprice9='0',showprice10='0',showprice11='0',showprice12='0',showprice13='0',serial3='44a31748dcc9eba74d9b43424c373ad9140cf58047d859719ce4980e548afbebe140fa05fac50dce2c3d75d470ba3f1fdb7cf6a07a52b3cb3685408882a88dc2',associatedtags='0',commentClientChasis='0',dollarExType='1',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0' WHERE programsettingsid = '1';
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 < "2025-12-21 20:32:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:32:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:36", deviceType = "MOBILE" WHERE userid = -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 < "2025-12-21 20:32:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:36", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:32:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:32:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:02:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:21", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:33:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:03:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:34:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:04:46", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 20:34:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:04:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:02", deviceType = "DESKTOP" WHERE userid = -1;
INSERT INTO lastbillidspricesupdated (buybill, buyandret, retbuy, sell, sellandret, retsell,buyquantity,buyandretquantity) VALUES ('0', '0', '0', '0', '0', '0','0','0'); -- id=1
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:35:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:05:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:38:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:08:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:38:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:08:25", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:38:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:08:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:38:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:08:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:39:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:09:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:40:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:10:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:26", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:41:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:11:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:42:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:12:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:42:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:12:17", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 20:42:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:12:17", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:42:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:12:21", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:42:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:12:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:34", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069487103ee0e3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2025-12-22 00:13:34', '069487103ee0e3', '2', '-470.00', '-480', '0', '1', '10', '10', '0', '-10', '1', '2025-12-22 00:13:34', '', '-1', '0', 'hazem','1', '1', '5', '0', ' hazem', '1', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=2
UPDATE client SET  clientdebt = '-480', userid = '-1' WHERE clientid = '2';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('2','-470.00','10','1','اضافة فاتورة مردوات مبيعات','2', '-480', '2025-12-22 00:13:34', '-1', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','10','1','2025-12-22 00:13:34','0','0','',''); -- id=36
UPDATE client SET  inUse = 0 where clientid = 2;
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 ('10.00', '00004', '2', '3', '4', '1', '10', '10', '0', '', '0', '0', '4', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','10','10','0','','0'); -- id=2
UPDATE returnsellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where returnsellbilldetailid = 2;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 10, 10, 10, 10
                    , 10, 10, 10, 0, 1, 0, 0, 10, 10)
                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+10, returnSellCostBuyPrice = returnSellCostBuyPrice+10, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+10
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+10, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+10
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+10
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+10
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+10
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+10
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 10, 10, 10, 10
                    , 10, 10, 10, 0, 0, 10, 10)
                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+10, returnSellCostBuyPrice = returnSellCostBuyPrice+10, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+10
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+10, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+10
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+10
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+10
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+10
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+10;
UPDATE storedetail SET  productquantity = '18', userid = '-1', storedetaildate = '2025-12-22 00:13:34' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '2', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '17', '18', '-1', '2025-12-22 00:13:34','0','0'); -- id=71
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '-1', '0', '0', '2025-12-22 00:13:34','اضافة فاتورة مردود مبيعات رقم 2','1','0',null,'0','2','returnsellbillController.php?do=showDetail&returnsellbillid=2'); -- id=64
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('64', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '-1', '0', '0', '2025-12-22 00:13:34','اضافة فاتورة مردود مبيعات رقم 2 - صرف البضاعة من المخزن','1','0',null,'0','2','returnsellbillController.php?do=showDetail&returnsellbillid=2'); -- id=65
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('65', null, '', '','0');update returnsellbill set dailyentryid='64,0,65' where returnsellbillid=2;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 10, 10, 10, 10
                    , 10, 10, 10 ,0, 0, 10, 10)
                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+10, returnSellCostBuyPrice = returnSellCostBuyPrice+10, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+10
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+10, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+10
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+10
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+10
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+10
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+10;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 10, 10, 10, 10
                    , 10, 10, 10 ,0, 0, 10, 10)
                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+10, returnSellCostBuyPrice = returnSellCostBuyPrice+10, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+10
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+10, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+10
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+10
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+10
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+10
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+10;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -10, -10, -10
                    , -10, -10, -10, -10, -10, -10)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-10, netSellCostBuyPrice = netSellCostBuyPrice+-10
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-10
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-10
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-10
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-10
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-10
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069487103ee0e3 and sellbillId = 2 and returnsellbillId = 2
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:43:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:13:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:44:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:14:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:44:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:14:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:45:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:15:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:45:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:15:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:46:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:16:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:48:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:18:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:48:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:18:39", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:50:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:20:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:50:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:20:17", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:50:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:20:19", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:50:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:20:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:51:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:21:27", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:52:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:22:00", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:52:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:22:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:52:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:22:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:52:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:22:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:53:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:23:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:53:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:23:31", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:54:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:24:22", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:54:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:24:35", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:54:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:24:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:55:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:25:31", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:55:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:25:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:55:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:25:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:55:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:25:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:55:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:25:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:57:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:27:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:59:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:29:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:59:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:29:16", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:59:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:29:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 20:59:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:29:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:21", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:00:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:30:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:26", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:02:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:32:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:03:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:33:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:04:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:34:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:04:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:34:40", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 27;
UPDATE sellbill SET  sellbillsysdate = '2025-12-22 00:34:40', userid = '-1',delbyuserid = '-1', conditions = '1'  WHERE sellbillid = '27';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 3;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:09:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:39:09", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 27;
UPDATE sellbill SET  sellbillsysdate = '2025-12-22 00:39:09', userid = '-1',delbyuserid = '-1', conditions = '1'  WHERE sellbillid = '27';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 3;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:12:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:42:09", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 27;
UPDATE sellbill SET  sellbillsysdate = '2025-12-22 00:42:09', userid = '-1',delbyuserid = '-1', conditions = '1'  WHERE sellbillid = '27';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 3;
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 28;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2025-12-22', 30, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-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, '2025-12-22', 30, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '21', userid = '-1', storedetaildate = '2025-12-22 00:42:09' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '3', '0', '27', 'تعديل فاتورة مبيعات', 'sellbillController.php', '18', '21', '-1', '2025-12-19 03:04:44','0','0'); -- id=72
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-510', userid = '-1' WHERE clientid = '2';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('2','-480.00','30.00','1','تعديل فاتورة مبيعات','27', '-510', '2025-12-19 03:04:44', '-1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '30', '0', null, '0', null, null,'', '0','1','1','30','1','2025-12-19 03:04:44','0','0','',''); -- id=37
UPDATE client SET  inUse = 0 where clientid = 2;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 30, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2025-12-22', 30, 30, 30
                    , 30, 30, 30, 30
                    , 0, 0, 0, 0
                    , 0, 0, 0, 30, 30, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-30, sellCostBuyPrice =sellCostBuyPrice-30
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-30, sellCostMeanBuyPrice = sellCostMeanBuyPrice-30
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-30, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-30
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-30
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-30
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-30
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 30, 30, 30
                    , 30, 30, 30, 30, 30, 30)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-30, netSellCostBuyPrice = netSellCostBuyPrice-30
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-30
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-30
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-30
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-30
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-30
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-30
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-30;

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


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

COMMIT;
BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,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 ('2025-12-19 03:04:44', '06944a4938f8f6', '2', '-510.00', '-470', '0', '1', '40', '40', '0', '40', '1', '2025-12-19 03:04:44', '', '-1', '0', 'hazem', '1', '1', '3', '0', ' hazem', '4', '27', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2025-12-19','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','0','0','0',''); -- id=33
UPDATE client SET  clientdebt = '-470', userid = '-1' WHERE clientid = '2';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('2','-510.00','40','0','اضافة فاتورة مبيعات (معدله)','33', '-470', '2025-12-22 00:42:10', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '40', '0', null, '0', null, null,'', '0','1','1','30','1','2025-12-19 03:04:44','0','0','',''); -- id=38
UPDATE client SET  inUse = 0 where clientid = 2;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10','00004', '33', '3', '4', '4.00', '10', '40', '0', '', '0', '2025-12-22 00:42:10', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','3-4,','1','1','0','0','10','40','0','','0','0.00','0','0','0','0'); -- id=40
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 40;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2025-12-22', 40, 40, 40
                    , 40, 40, 40, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 40, 40, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+40
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 40, 40, 40
                    , 40, 40, 40, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0, 40, 40, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+40
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '17', userid = '-1', storedetaildate = '2025-12-22 00:42:10' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '4', '1', '33', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '21', '17', '-1', '2025-12-22 00:42:10','0','0'); -- id=73
UPDATE dailyentry SET totalcreditor = '30.00', totaldebtor = '30.00', thedate = '2025-12-19', userid = '-1', `condition` = '0', reverseofid = '-10', dDateTime = '2025-12-19 03:05:00', entryComment = 'اضافة فاتورة مبيعات رقم 27', fromFlag = '1',related='0',isopeningentry='0',operationId='27',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=27' WHERE id = '47';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30.00', '30.00', '2025-12-22', '-1', '0', '47', '2025-12-22 00:42:10','تم عكس القيد رقم 47 ','1','0','0','0','0',''); -- id=66
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('66', '419', '30.00', '','0'); -- id=62
UPDATE accountstree SET name = 'hazem', customName = 'hazem', customNameEn = 'hazem', nameEn = 'hazem', parent = '58', accountNature = '0', theValue = '-500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '-1', del = '0', sysdate = '2025-12-21 18:25:16' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('66', '143', '30.00', '','0'); -- id=62
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '740', 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 = '30.00', totaldebtor = '30.00', thedate = '2025-12-19', userid = '-1', `condition` = '0', reverseofid = '-10', dDateTime = '2025-12-19 03:05:00', entryComment = 'اضافة فاتورة مبيعات رقم 27 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='27',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=27' WHERE id = '48';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30.00', '30.00', '2025-12-22', '-1', '0', '48', '2025-12-22 00:42:10','تم عكس القيد رقم 48 ','1','0','0','0','0',''); -- id=67
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('67', '402', '30.00', '','0'); -- id=63
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-199', theOrder = '0', layingOrder = '510104', 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 ('67', '382', '30.00', '','0'); -- id=63
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '30', 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 ( '40', '40', '2025-12-22', '-1', '0', '0', '2025-12-22 00:42:10','اضافة فاتورة مبيعات رقم 33','1','0',null,'0','33','sellbillController.php?do=showDetail&sellbillid=33'); -- id=68
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('68', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '40', '40', '2025-12-22', '-1', '0', '0', '2025-12-22 00:42:10','اضافة فاتورة مبيعات رقم 33 - صرف البضاعة من المخزن','1','0',null,'0','33','sellbillController.php?do=showDetail&sellbillid=33'); -- id=69
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('69', null, '', '','0');update sellbill set dailyentryid='68,0,69' where sellbillid=33;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 40, 40, 40
                    , 40, 40, 40, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,40, 40, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+40
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2025-12-22', 40, 40, 40
                    , 40, 40, 40, 40
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,40, 40, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+40, sellCostBuyPrice =sellCostBuyPrice+40
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+40, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+40
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+40
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+40
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 40, 40, 40
                    , 40, 40, 40, 40, 40, 40)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+40, netSellCostBuyPrice = netSellCostBuyPrice+40
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+40
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+40
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+40
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+40
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+40
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+40
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+40;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 27 and newid=33 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:12:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:42:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:13:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:43:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:15", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06948783742961
-- ----------------------------------------------------------------------------------------------------

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 ('2025-12-22 00:44:15', '06948783742961', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-22 00:44:15', '', '-1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','10','0','','0','0','10','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2025-12-22','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=34
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','اضافة فاتورة مبيعات','34', '0', '2025-12-22 00:44:15', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-22 00:44:15','0','0','',''); -- id=39
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10','00004', '34', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-22 00:44:15', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','3-1,','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=41
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 41;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2025-12-22 00:44:15' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '34', 'اضافة فاتورة مبيعات', 'sellbillController.php', '17', '16', '-1', '2025-12-22 00:44:15','0','0'); -- id=74
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '710',  userid = '-1' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('700','10', '0', '1', 'اضافة فاتورة مبيعات', '34', '710', '2025-12-22 00:44:15', '-1',  'sellbillController.php','1','','0'); -- id=34
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '-1', '0', '0', '2025-12-22 00:44:15','اضافة فاتورة مبيعات رقم 34','1','0',null,'0','34','sellbillController.php?do=showDetail&sellbillid=34'); -- id=70
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('70', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '-1', '0', '0', '2025-12-22 00:44:15','اضافة فاتورة مبيعات رقم 34 - صرف البضاعة من المخزن','1','0',null,'0','34','sellbillController.php?do=showDetail&sellbillid=34'); -- id=71
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('71', null, '', '','0');update sellbill set dailyentryid='70,0,71' where sellbillid=34;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10, 10, 10
                    , 10, 10, 10, 10, 10, 10)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10, netSellCostBuyPrice = netSellCostBuyPrice+10
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06948783742961 and sellbillId = 34 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:14:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 00:44:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:52:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:22:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:53:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:23:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:54:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:24:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:54:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:24:39", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:54:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:24:45", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:43", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:45", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:45", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:45", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:55:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:25:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:56:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:26:38", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:00", deviceType = "MOBILE" WHERE userid = -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 < "2025-12-21 21:57:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:01", deviceType = "MOBILE" WHERE userid = -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 < "2025-12-21 21:57:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:03", deviceType = "MOBILE" WHERE userid = -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 < "2025-12-21 21:57:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:09", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:57:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:27:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE client SET inUse=0 WHERE clientid = 1;
UPDATE client SET inUse=0 WHERE clientid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:58:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:28:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 21:59:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:29:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:00:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:30:07", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:00:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:30:21", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:00:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:30:29", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:00:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:30:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:21", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:01:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:31:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:02:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:32:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:02:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:32:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:36", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:39", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:40", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:03:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:33:42", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:04:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:34:06", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:04:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:34:24", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:04:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:34:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:05:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:35:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:05:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:35:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:05:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:35:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:05:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:35:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:05:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:35:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:06:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:36:31", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:06:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:36:36", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:06:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:36:44", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:06:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:36:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:07:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:37:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:07:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:37:33", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:07:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:37:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:07:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:37:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:08:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:38:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:08:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:38:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:08:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:38:26", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:09:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:39:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:09:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:39:45", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:09:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:39:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:09:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:39:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:10:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:40:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:10:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:40:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:10:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:40:42", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:39", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:43", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:11:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:41:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:48", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:12:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:42:58", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:06", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:32";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:32", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:13:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:43:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:14:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:44:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:14:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:44:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:15:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:45:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:15:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:45:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:15:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:45:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:18", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:34", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:16:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:46:43", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:17:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:47:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:17:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:47:17", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:17:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:47:27", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:17:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:47:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:18:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:48:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:42", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:19:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:49:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:20:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:50:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:20:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:50:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:20:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:50:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:20:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:50:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:20:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:50:43", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:22:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:52:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:22:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:52:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:22:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:52:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:23:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:53:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:23:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:53:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:23:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:53:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:24:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:24:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:09", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:24:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:24:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:12", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:24:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:24:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:14", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:24:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:54:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:25:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:55:41", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:26:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:56:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:27:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:57:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:27:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:57:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:27:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:57:22", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:27:32";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:57:32", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:27:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:57:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:03", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:28:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:45", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:28:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:58:58", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:29:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 01:59:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:05", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:30:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:32";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:32", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:30:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:00:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:31:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:01:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:31:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:01:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:31:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:01:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:26", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:40", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:42", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:32:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:44", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:32:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:02:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:33:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:03:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:33:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:03:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:33:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:03:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:33:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:03:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:33:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:03:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:34:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:04:01", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:34:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:04:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:34:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:04:15", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:34:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:04:15", deviceType = "DESKTOP" WHERE userid = -1;
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 < "2025-12-21 22:36:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:06:05', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=471
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 < "2025-12-21 22:36:05";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:06:06', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=472
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-22 02:06:23', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=473
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-22 02:06:26', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=474
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:06:27', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=show'); -- id=475
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-22 02:06:27', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php?do=show'); -- id=476
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:06:28', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=show'); -- id=477
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2025-12-22 02:06:29', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientController.php?do=show'); -- id=478
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:36:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:06:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('menuurController.php', '2025-12-22 02:06:37', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/menuurController.php?do=show'); -- id=479
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:37:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:07:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2025-12-22 02:07:20', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/userController.php'); -- id=480
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:37:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:07:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2025-12-22 02:07:49', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/userController.php?do=add'); -- id=481
INSERT INTO user (username, password, usergroupid, employeename, currentdate, conditions, saveid,userstoreid ,awardrate,searchinonesave, branchId,question, answer,blockedByLimits,directSaveBills,userstoreidDef,empid,obygyDoctorId,lang,viewclients,viewbills,storeSupervisor,storeSupervisorStores,projectids,bankids,saveids,searchinonestorebalance,storeids,webApiId,closeSavid,charityids,laterNakdiUserIds,awardrategomla,awardratehalf,dellaternakdipayed) VALUES ('hazem', '123', '3', 'hazem', '2025-12-22', '0', '1', '-1' ,'0' ,'0','-1','','','0','0','-1','0','0','','1','1','0','','-1,','-1,','1','0','-1','0','1','-1,','-1,-1','0','0','1'); -- id=2
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:37:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:07:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userController.php', '2025-12-22 02:07:56', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/userController.php?do=show'); -- id=482
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 < "2025-12-21 22:38:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:08:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:08:53', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=483
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 < "2025-12-21 22:38:54";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:08:54', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=484
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 < "2025-12-21 22:39:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:09:13', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=485
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 < "2025-12-21 22:39:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:09:13', '2', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=486
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:09:23', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=487
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:09:25', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=488
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:09:26', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=489
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:09:44', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=490
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 < "2025-12-21 22:39:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:09:45', '2', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=491
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:09:48', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=492
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 < "2025-12-21 22:39:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:49", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:09:49', '2', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=493
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:39:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:09:59", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:09:59', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=494
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:40:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:10:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:10:07', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=495
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:40:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:10:08", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:10:08', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=496
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:40:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:10:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:10:09', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=497
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:40:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:10:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:10:10', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=498
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 < "2025-12-21 22:40:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:10:39', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=499
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 < "2025-12-21 22:40:40";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:10:40', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=500
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:41:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:11:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:11:17', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=501
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:41:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:11:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:11:24', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=502
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:41:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:11:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:11:34', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=503
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:41:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:11:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:11:45', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=504
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:41:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:11:51", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:11:51', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/savedailyController.php'); -- id=505
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:12:02', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=506
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:07', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=507
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:09', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=508
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:10', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=509
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:11', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=510
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:12', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=511
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:13', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=512
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:14', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=513
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:15', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=514
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:16', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=515
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:17', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=516
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:18', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=517
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:20', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=518
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:21', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=519
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:21', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=520
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:12:22', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php?do=show'); -- id=521
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 < "2025-12-21 22:42:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:39", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:42:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:39", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:42:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:12:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:12", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:26", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:43:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:13:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE product SET productName = 'prod1', productDescription = '', productCatId = '1', productBuyPrice = '12.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00001',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10.00',lastbuyprice_withDiscount = '10',meanbuyprice = '11.00',meanbuyprice_withDiscount = '11' , productbuypricereal = '10.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='10',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='11',meanbuyprice_withTax='11',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='10',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1, 1,'2025-12-22 02:14:04',-1)
                ON DUPLICATE KEY UPDATE productid = 1, edited = 1, sysdate = '2025-12-22 02:14:04', userid = -1; -- id=1
UPDATE product SET productName = 'haxem', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-19', conditions = '0', userId = '1', limitamount = '1', parcode = '00006',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10.00',lastbuyprice_withDiscount = '10',meanbuyprice = '10.00',meanbuyprice_withDiscount = '10' , productbuypricereal = '10.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='10',meanbuyprice_withTax='10',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '6';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (6, 1,'2025-12-22 02:14:06',-1)
                ON DUPLICATE KEY UPDATE productid = 6, edited = 1, sysdate = '2025-12-22 02:14:06', userid = -1; -- id=6
UPDATE productunit SET proUnitBuyPrice  = 10.00 * productnumber WHERE productid = 6;
UPDATE product SET productName = 'haxem', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-19', conditions = '0', userId = '1', limitamount = '1', parcode = '00006',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10.00',lastbuyprice_withDiscount = '10',meanbuyprice = '10.00',meanbuyprice_withDiscount = '10' , productbuypricereal = '10.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='10',meanbuyprice_withTax='10',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '6';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (6, 1,'2025-12-22 02:14:14',-1)
                ON DUPLICATE KEY UPDATE productid = 6, edited = 1, sysdate = '2025-12-22 02:14:14', userid = -1; -- id=6
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:44:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:14:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:44:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:14:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:44:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:14:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:45:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:15:07", deviceType = "DESKTOP" WHERE userid = -1;
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 < "2025-12-21 22:46:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:16:02', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=522
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 < "2025-12-21 22:46:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:16:02', '2', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=523
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:05', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=524
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:06", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:06', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=525
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:16:07', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=526
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:09', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=527
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:16', '2', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=528

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069488dc999058
-- ----------------------------------------------------------------------------------------------------

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 ('2025-12-22 02:16:16', '069488dc999058', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-22 02:16:16', '', '2', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','10','0','','0','0','10','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2025-12-22','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=35
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','اضافة فاتورة مبيعات','35', '0', '2025-12-22 02:16:16', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-22 02:16:16','0','0','',''); -- id=40
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 3;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('10','00004', '35', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-22 02:16:16', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','3-1,','1','1','0','0','10','10','0','','0','0.00','0','0','0','0'); -- id=42
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 10.00
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where sellbilldetailid = 42;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (4, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2025-12-22 02:16:16' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '35', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '15', '2', '2025-12-22 02:16:16','0','0'); -- id=75
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '720',  userid = '2' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('710','10', '0', '1', 'اضافة فاتورة مبيعات', '35', '720', '2025-12-22 02:16:16', '2',  'sellbillController.php','1','','0'); -- id=35
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:16','اضافة فاتورة مبيعات رقم 35','1','0',null,'0','35','sellbillController.php?do=showDetail&sellbillid=35'); -- id=72
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('72', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:16','اضافة فاتورة مبيعات رقم 35 - صرف البضاعة من المخزن','1','0',null,'0','35','sellbillController.php?do=showDetail&sellbillid=35'); -- id=73
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('73', null, '', '','0');update sellbill set dailyentryid='72,0,73' where sellbillid=35;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 10, 10, 10
                    , 10, 10, 10, 10
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10, 10, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10, sellCostBuyPrice =sellCostBuyPrice+10
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10, 10, 10
                    , 10, 10, 10, 10, 10, 10)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10, netSellCostBuyPrice = netSellCostBuyPrice+10
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069488dc999058 and sellbillId = 35 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:16', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=529
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:16:19', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=530
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:28', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=531
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:30", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:30', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=532
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:30", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:30', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=533
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:31', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=534
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:41', '2', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=535

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069488ddfec125
-- ----------------------------------------------------------------------------------------------------

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 ('2025-12-22 02:16:41', '069488ddfec125', '1', '0.00', '0', '0', '1', '120.00', '120', '120', '0', '1', '2025-12-22 02:16:41', '', '2', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','120','0','','0','0','120','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2025-12-22','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=36
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','اضافة فاتورة مبيعات','36', '0', '2025-12-22 02:16:41', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '120', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-22 02:16:41','0','0','',''); -- id=41
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('100','00005', '36', '3', '5', '1', '120', '120', '0', '', '0', '2025-12-22 02:16:41', '5', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','120','120','0','','0','0.00','0','0','0','0'); -- id=43
UPDATE sellbilldetail SET  lastbuyprice = 100.00 , meanbuyprice = 100.00, lastbuyprice_withDiscount = 100.00, meanbuyprice_withDiscount = 100.00
        , lastbuyprice_withTax = 100, meanbuyprice_withTax = 100, lastbuyprice_withDiscountAndTax = 100
                where sellbilldetailid = 43;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (5, '2025-12-22', 120, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 120, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '2025-12-22 02:16:41' WHERE storedetailid = '5';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('5', '1', '1', '1', '36', 'اضافة فاتورة مبيعات', 'sellbillController.php', '-2', '-3', '2', '2025-12-22 02:16:41','0','0'); -- id=76
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '840',  userid = '2' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('720','120', '0', '1', 'اضافة فاتورة مبيعات', '36', '840', '2025-12-22 02:16:41', '2',  'sellbillController.php','1','','0'); -- id=36
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '120', '120', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:41','اضافة فاتورة مبيعات رقم 36','1','0',null,'0','36','sellbillController.php?do=showDetail&sellbillid=36'); -- id=74
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('74', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100', '100', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:41','اضافة فاتورة مبيعات رقم 36 - صرف البضاعة من المخزن','1','0',null,'0','36','sellbillController.php?do=showDetail&sellbillid=36'); -- id=75
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('75', null, '', '','0');update sellbill set dailyentryid='74,0,75' where sellbillid=36;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 120, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, '2025-12-22', 120, 100, 100
                    , 100, 100, 100, 100
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,100, 100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+120, sellCostBuyPrice =sellCostBuyPrice+100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 120, 100, 100
                    , 100, 100, 100, 100, 100, 100)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+120, netSellCostBuyPrice = netSellCostBuyPrice+100
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+100
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+100
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+100
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+100
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+100
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+100
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+100;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069488ddfec125 and sellbillId = 36 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:41', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=536
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:44', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=537
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:53', '2', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=538

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069488decca96f
-- ----------------------------------------------------------------------------------------------------

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 ('2025-12-22 02:16:53', '069488decca96f', '1', '0.00', '0', '0', '1', '50', '50', '-50', '0', '1', '2025-12-22 02:16:53', '', '2', '0', 'نقدي','1', '0', '5', '0', 'نقدي', '5', '0', '', '','','','-1','0','0','0','','0','-50','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=3
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','1','اضافة فاتورة مردوات مبيعات','3', '0', '2025-12-22 02:16:53', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '50', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-22 02:16:53','0','0','',''); -- id=42
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 ('12.00', '00001', '3', '1', '1', '5', '10', '50', '0', '', '0', '0', '1', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','10','50','0','','0'); -- id=3
UPDATE returnsellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 11.00, lastbuyprice_withDiscount = 10.00, meanbuyprice_withDiscount = 11.00
        , lastbuyprice_withTax = 11, meanbuyprice_withTax = 11, lastbuyprice_withDiscountAndTax = 10
                where returnsellbilldetailid = 3;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 50, 60, 50, 55
                    , 50, 55, 50, 0, 5, 0, 0, 55, 55)
                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+50, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+50
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+55, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+50
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+55
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+50
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+55
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+55
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+5;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 50, 60, 50, 55
                    , 50, 55, 50, 0, 0, 55, 55)
                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+50, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+50
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+55, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+50
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+55
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+50
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+55
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+55;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2025-12-22 02:16:53' WHERE storedetailid = '1';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1', '1', '5', '0', '3', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '5', '2', '2025-12-22 02:16:53','0','0'); -- id=77
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '790',  userid = '2' WHERE saveid = '1';
UPDATE save SET  inUse = 0 where saveid = 1;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('840','-50', '1', '1', 'اضافة فاتورة مردوات مبيعات', '3', '790', '2025-12-22 02:16:53', '2',  'returnsellbillController.php','1','','0'); -- id=37
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50', '50', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:53','اضافة فاتورة مردود مبيعات رقم 3','1','0',null,'0','3','returnsellbillController.php?do=showDetail&returnsellbillid=3'); -- id=76
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('76', null, '', '','0');INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50', '50', '2025-12-22', '2', '0', '0', '2025-12-22 02:16:53','اضافة فاتورة مردود مبيعات رقم 3 - صرف البضاعة من المخزن','1','0',null,'0','3','returnsellbillController.php?do=showDetail&returnsellbillid=3'); -- id=77
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('77', null, '', '','0');update returnsellbill set dailyentryid='76,0,77' where returnsellbillid=3;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 50, 60, 50, 55
                    , 50, 55, 50 ,0, 0, 55, 55)
                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+50, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+50
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+55, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+50
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+55
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+50
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+55
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+55;
 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, '2025-12-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 50, 60, 50, 55
                    , 50, 55, 50 ,0, 0, 55, 55)
                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+50, returnSellCostBuyPrice = returnSellCostBuyPrice+60, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+50
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+55, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+50
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+55
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+50
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+55
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+55;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -50, -60, -50
                    , -55, -50, -55, -50, -55, -55)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-50, netSellCostBuyPrice = netSellCostBuyPrice+-60
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-50
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-55
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-50
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-55
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-50
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-55
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-55;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069488decca96f and sellbillId = 3 and returnsellbillId = 3
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:16:53', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=539
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:46:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:16:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:16:56', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=540
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:47:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:17:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2025-12-22 02:17:03', '2', 'showDetail', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/returnsellbillController.php?do=showDetail&returnsellbillid=3'); -- id=541
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:47:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:17:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:17:09', '2', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=542
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:47:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:17:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-22 02:17:12', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=543
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 < "2025-12-21 22:47:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:17:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:17:34', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=544
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 < "2025-12-21 22:47:35";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:17:35', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=545
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:47:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:17:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:17:56', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=546
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-22 02:18:04', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php?do=show'); -- id=547
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:18:08', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=548
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-22 02:18:11', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=549
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2025-12-22 02:18:24', '1', 'oneSupplier', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierReportsController.php?do=oneSupplier'); -- id=550
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2025-12-22 02:18:26', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientController.php'); -- id=551
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2025-12-22 02:18:26', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/profitreportController.php'); -- id=552
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:38", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2025-12-22 02:18:38', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/profitreportController.php'); -- id=553
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:48:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:18:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2025-12-22 02:18:58', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/profitreportController.php'); -- id=554
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:49:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:19:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2025-12-22 02:19:05', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/profitreportController.php'); -- id=555
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 1;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;
;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:49:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:19:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('profitreportController.php', '2025-12-22 02:19:09', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/profitreportController.php'); -- id=556
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:49:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:19:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('menuurController.php', '2025-12-22 02:19:49', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/menuurController.php?do=show'); -- id=557
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:50:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:20:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-22 02:20:06', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=558
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:50:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:20:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:20:12', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=559
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 < "2025-12-21 22:50:12";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:20:12', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=560
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:50:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:20:17", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:20:17', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/index.php'); -- id=561
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 < "2025-12-21 22:50:17";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:20:17', '1', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=562
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 < "2025-12-21 22:50:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:20:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-22 02:20:57', '2', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=563
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 < "2025-12-21 22:50:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:20:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-22 02:20:57', '2', 'handleExpiredCards', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=564
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 < "2025-12-21 22:51:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:21:23", deviceType = "DESKTOP" WHERE userid = -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 < "2025-12-21 22:51:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:21:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:51:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:21:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:51:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:21:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-21 22:52:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-22 02:22:03", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =43
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
UPDATE client SET  clientdebt = '-670' , clientdate = '2025-12-22 02:22:03', userid = '-1' WHERE clientid = '2';
UPDATE client SET  inUse = 0 where clientid = 2;
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('2','-470.00','200','1','ايصال تحصيل (( قبض من عميل ))','43', '-670', '2025-12-22 02:21:50', '-1', 'clientPayedDeptController.php', '   ', '200', '0', null, '0', null, null,'', '-1','1','1','200','1','','2','0','','.'); -- id=43
UPDATE save SET  savecurrentvalue = '990',  userid = '-1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('790.00','200', '0', '1', 'ايصال تحصيل (( قبض من عميل ))', '43', '990', '2025-12-22 02:22:03', '-1',  'clientPayedDeptController.php','2','','0'); -- id=38
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200', '200', '2025-12-22', '-1', '0', '0', '2025-12-22 02:22:03','اضافة ايصال سداد للعميل hazem','1','0',null,'0','43','clientPayedDeptController.php?do=show&id=43'); -- id=78
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('78', null, '', '','0');UPDATE clientdebtchange SET clientid = '2', clientdebtchangebefore = '-470.000', clientdebtchangeamount = '200.000', clientdebtchangetype = '1', processname = 'ايصال تحصيل (( قبض من عميل ))', clientdebtchangemodelid = '43', clientdebtchangeafter = '-670.000', clientdebtchangedate = '2025-12-22 02:21:50', userid = '-1', tablename = 'clientPayedDeptController.php', comment = '   ', totalOperationCost = '200.000',discount='', reciptid='0', dailyentryid = '78',seller = '0',currencyId='1',conversionFactor='1',payedInCurrency='200',saveConversionFactor='1',totalpayments='0',tagids='',file='.' WHERE clientdebtchangeid = '43';
COMMIT;

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

