-- 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 = 4;
-- ALTER TABLE erp1.buybillcurr AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buybilldetail AUTO_INCREMENT = 4;
-- ALTER TABLE erp1.buybilldetailoffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buybilloffer AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.buypriceshistorybook AUTO_INCREMENT = 3;
-- 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 = 13;
-- 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 = 15;
-- ALTER TABLE erp1.dailyentrycreditor AUTO_INCREMENT = 15;
-- ALTER TABLE erp1.dailyentrydebtor AUTO_INCREMENT = 15;
-- 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.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 = 3;
-- 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 = 243;
-- ALTER TABLE erp1.movementmanagedeleted AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.newdbbackup AUTO_INCREMENT = 1;
-- 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 = 6;
-- 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 = 6;
-- 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 = 6;
-- 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 = 5;
-- ALTER TABLE erp1.quickprofitday AUTO_INCREMENT = 5;
-- ALTER TABLE erp1.quickprofitgeneral AUTO_INCREMENT = 2;
-- ALTER TABLE erp1.quickprofitproduct AUTO_INCREMENT = 8;
-- ALTER TABLE erp1.quickprofitstore AUTO_INCREMENT = 8;
-- ALTER TABLE erp1.religions AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.relusergroupproperties AUTO_INCREMENT = 3222;
-- 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 = 9;
-- ALTER TABLE erp1.savestock AUTO_INCREMENT = 3;
-- 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 = 11;
-- 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 = 11;
-- 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 = 8;
-- 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 = 6;
-- ALTER TABLE erp1.storemovement AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.storemovement_main AUTO_INCREMENT = 1;
-- ALTER TABLE erp1.storereport AUTO_INCREMENT = 14;
-- 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 = 1;
-- 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 = 1027;
-- 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-18 20:30:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:00:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 00:00:37', '1', '', '127.0.0.1', '', 'DESKTOP','https://localhost/erp19/controllers/productCatController.php'); -- id=254
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 20:30:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:00:52", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 00:00:52', '1', '', '127.0.0.1', '', 'MOBILE','https://localhost/erp19/controllers/productCatController.php'); -- id=255
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:06:17";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE 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-18',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='1',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='0',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='0',saudielectronicinvoice='0',saudielectronicinvoclient='0',productDiscount='0' WHERE programsettingsid = '1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:06:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:36:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2025-12-19 00:36:49', '1', '', '127.0.0.1', '', 'DESKTOP','https://localhost/erp19/controllers/index.php'); -- id=256
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-19',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='57a85883346811cbf7076a51c5bd887a2e96bf2df777a95668d34a3537aceedfe3f238b684c96d789642405e6f69293dbb311716d957a5ac40fe5570cf297eaf',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='0' , date='1' , limitamount = '0' , measuringunit = '1' , print_amount = '0' , billid = '0' , precentages = '1' , realprice = '1' ,delegate_seller = '0' , storeserial = '1' ,clientfieldrequired ='0' , clientcodname='0' , colortype = '0' , nakdyOnly = '0' , nakdyKashf = '0' , discount_pres_direct = '0' , general_discount = '0' , sells_return = '0' ,scunitname ='0',vatValue = '0.00',syncstructure = '1',showPrevPrices = '0',isOpticProg='1',reportsPlusHours = '2' , showM5zon = '1',restaurantStoreId = '1',restuarantPrintTimeout = '8',sumSameProductForStore = '0', editAllPrice = '0', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '1' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='last_discount',Profitevaluation='last_discount' , delivery='0',premiums = '1',operationnumEdit = '0',noOfDecimalPlaces = '2',unReviewBills = '0', unReviewBillsPass = '123',billReviewNote = '',tamweenBakery = '0',three_months = '0',six_months = '0',twelve_months = '0',eighteen_months = '0',twentyfour_months = '0',thirty_months = '0',sixthirty_months = '0',fortytwo_months = '0',fortyeight_months = '0',mandobCollectionRatio='0',takeAwayClient = '0',restaurantServiceOn = ',0,0,0,',earlyrepayment = '0',visaPay = '0',headerPrint='38e56bc84e0c8adff190ee376e986bbd.png',headerPrintSand='',printSand='0',makeDailyEntry='1',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0',incomeclient='1',showserial='1',editservice='1',showCurrency='0',qrerp='1',valueadded='0',qrcodesh='0',printfoot='',sellorder='0',numberprint='0',valueaddedbuy='0',simpleAddClientInBill='0',licenseNo='',maintenance='0',showPrevDiscount='0',vatvalueqr='0.13043479',imgprinthide='0',parcodeprinttype = 'C128A',parcodeprintwidth='160',parcodeprinttextsize='14',parcodeprintCurr='L.E',sizecolorDigits='3',searchBarcodeInBill='0',allowMobileLogin='0',lanAllowType='0',wanAllowType='0',sendBillToRestaurant='0',obgyPharmacyGroups='',updateProUnitPricesOnPriceUpdate='0',ebill='0',valueaddeddiscount='0',clientdetail='1',showPrevPricesRet='0',showPrevDiscountRet='0',eunitInTax='',showStoreToDetail='0',showBuyPriceAtProductddl='0',specialexpenses='1',ratioshow='0',defaultUnitPriceAtBill='0',rulers='0',quantitynew='0',showBillOperationSearch='0',obygyFolder='',clientsell='0',
                preorderperiod='0',useListPrice='0',ebillclient='0',importproduct='0',realestateunits='0',expensesupplier='0',changeOrderproduct='0',searchlimit='0',typebill='',roundnumbersbilltotal='0',noOfDecimalPlacesBillTotal='0',dailyEntryCostprice='last_discount',storeRecieveType='0',clientPhoneReq='0',addServiceToBill='0',realestatedev='1',showprice4='0',showprice5='0',showprice6='0',showprice7='0',showprice8='0',showpriceall='1',showpricehalf='1',showpriceunit='1',showbillstatus='0',showbilldeliverydate='0',enablequantityfractions='1',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='0',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='0',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 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-18 21:06:54";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2025-12-19 00:36:54', '1', 'handleExpiredCards', '127.0.0.1', '', 'DESKTOP','https://localhost/erp19/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=257
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:07:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:37:18", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:37:18', '1', 'bill', '127.0.0.1', '', 'MOBILE','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=258
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:08:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:38:55", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2025-12-19 00:38:55', '1', '', '127.0.0.1', '', 'MOBILE','https://localhost/erp19/controllers/salesreport.php'); -- id=259
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:13:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:43:52", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2025-12-19 00:43:52', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/salesreport.php'); -- id=260
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:13:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:43:58", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-19 00:43:58', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=261
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:13:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:43:58", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:43:58', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'MOBILE','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=262
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:44:04', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=263
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:44:05', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=264
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:44:07', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=265
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 00:44:08', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=266
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-19 00:44:09', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=267
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2025-12-19 00:44:10', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierPayedDeptController.php'); -- id=268
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-19 00:44:10', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=269
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2025-12-19 00:44:11', '1', 'oneSupplier', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierReportsController.php?do=oneSupplier'); -- id=270
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 00:44:12', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productCatController.php'); -- id=271
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:44:13', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=272
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2025-12-19 00:44:15', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/storedetailController.php'); -- id=273
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:44:16', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=274
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:44:47', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=275
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:14:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:44:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:44:48', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=276
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:15:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:45:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:45:18', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=277
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694483e0ab2bf', '2025-12-19 00:44:48', '1', '0.00', '800', '0', '0', '800.00',  '800', '0', '800', '1', '2025-12-19 00:45:18', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=4
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '4', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 00:45:18', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=4
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 00:44:48', 1, 4, 0, 0
                    , 10, 20, 0, 0, 1, '2025-12-19 00:45:18')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 00:45:18' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '4', '', '0', '0'); -- id=3
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 4 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 4;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '4', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2025-12-19 00:44:48','0','0'); -- id=16
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:20:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:50:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:50:24', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=278
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:20:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:50:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:50:31', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=279
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:20:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:50:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:50:48', '1', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=280

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694485377100b
-- ----------------------------------------------------------------------------------------------------

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-19 00:50:48', '0694485377100b', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 00:50:48', '', '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-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=12
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','اضافة فاتورة مبيعات','12', '0', '2025-12-19 00:50:48', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 00:50:48','0','0','',''); -- id=14
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', '12', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 00:50:48', '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=13
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4)
                , userid = 1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '12', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '1', '2025-12-19 00:50:48','0','0'); -- id=17
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '760',  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 ('750','10', '0', '1', 'اضافة فاتورة مبيعات', '12', '760', '2025-12-19 00:50:48', '1',  'sellbillController.php','1','','0'); -- id=10
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '1', '0', '0', '2025-12-19 00:50:48','اضافة فاتورة مبيعات رقم 12','1','0',null,'0','12','sellbillController.php?do=showDetail&sellbillid=12'); -- id=17
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('17', '383', '10', '','0'); -- id=17
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '750', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('17', '143', '10', '','0'); -- id=17
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '250', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '1', '0', '0', '2025-12-19 00:50:48','اضافة فاتورة مبيعات رقم 12 - صرف البضاعة من المخزن','1','0',null,'0','12','sellbillController.php?do=showDetail&sellbillid=12'); -- id=18
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('18', '402', '-10', '','0'); -- id=18
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-230', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('18', '382', '-10', '','0'); -- id=18
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10230', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='17,0,18' where sellbillid=12;
 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-19', 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-19', 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 0694485377100b and sellbillId = 12 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:20:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:50:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:50:48', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=281
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:51:10', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=282
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:51:13', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=283
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:51:25', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=284
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069448561a1de0', '2025-12-19 00:51:13', '1', '0.00', '200', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 00:51:25', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=5
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '5', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 00:51:25', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=5
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 00:51:13', 1, 4, 0, 0
                    , 10, 20, 0, 0, 1, '2025-12-19 00:51:25')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 00:51:25' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '5', '', '0', '0'); -- id=4
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 5 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 5;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '5', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2025-12-19 00:51:13','0','0'); -- id=18
UPDATE supplier SET  suppliercurrentDebt = '200',suppliercurrentDebtInCurrency= '200' , userid = '1', supplierdate = '2025-12-19 00:51:25'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '0.00', '200', '0', 'اضافة فاتورة مشتريات', '5', '200', '2025-12-19 00:51:13', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','0','200','200','0',''); -- id=1
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:51:29', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=285
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:51:39', '1', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=286

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06944857173665
-- ----------------------------------------------------------------------------------------------------

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-19 00:51:39', '06944857173665', '1', '0.00', '0', '0', '1', '100.00', '100', '100', '0', '1', '2025-12-19 00:51:39', '', '1', '0', 'نقدي', '1', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','100','0','','0','0','100','0','0','0','0','0','0','0','0','','','','0','','0','','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=13
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','اضافة فاتورة مبيعات','13', '0', '2025-12-19 00:51:39', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '100', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 00:51:39','0','0','',''); -- id=15
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 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', '13', '3', '4', '10', '10', '100', '0', '', '0', '2025-12-19 00:51:39', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','3-10,','1','1','0','0','10','100','0','','0','0.00','0','0','0','0'); -- id=14
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4)
                , userid = 1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 100, -100, -100
                    , -100, -100, -100, -100
                    , 0, 0, 0, 0
                    , 0, 0, 0, -10, 0, -100, -100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, 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+-10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2025-12-19', 100, -100, -100
                    , -100, -100, -100, -100
                    , 0, 0, 0, 0
                    , 0, 0, 0, -100, -100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '10', '1', '13', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-10', '1', '2025-12-19 00:51:39','0','0'); -- id=19
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '860',  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 ('760','100', '0', '1', 'اضافة فاتورة مبيعات', '13', '860', '2025-12-19 00:51:39', '1',  'sellbillController.php','1','','0'); -- id=11
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100', '100', '2025-12-19', '1', '0', '0', '2025-12-19 00:51:39','اضافة فاتورة مبيعات رقم 13','1','0',null,'0','13','sellbillController.php?do=showDetail&sellbillid=13'); -- id=19
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('19', '383', '100', '','0'); -- id=19
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '850', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('19', '143', '100', '','0'); -- id=19
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '350', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-100', '-100', '2025-12-19', '1', '0', '0', '2025-12-19 00:51:39','اضافة فاتورة مبيعات رقم 13 - صرف البضاعة من المخزن','1','0',null,'0','13','sellbillController.php?do=showDetail&sellbillid=13'); -- id=20
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('20', '402', '-100', '','0'); -- id=20
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-330', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('20', '382', '-100', '','0'); -- id=20
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10330', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='19,0,20' where sellbillid=13;
 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-19', 100, -100, -100
                    , -100, -100, -100, -100
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,-100, -100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, 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-19', 100, -100, -100
                    , -100, -100, -100, -100
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,-100, -100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+100, 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, 100, -100, -100
                    , -100, -100, -100, -100, -100, -100)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+100, 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 06944857173665 and sellbillId = 13 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:21:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:51:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:51:39', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=287
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:27:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:57:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:57:22', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=288
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:27:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:57:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:57:33', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=289
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694486d27c5d7', '2025-12-19 00:57:22', '1', '200.00', '210', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 00:57:33', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=6
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '6', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 00:57:33', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=6
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 00:57:22', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 00:57:33')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 00:57:33' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '6', '', '0', '0'); -- id=5
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 6 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 6;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '1', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '6', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '1', '2025-12-19 00:57:22','0','0'); -- id=20
UPDATE supplier SET  suppliercurrentDebt = '210',suppliercurrentDebtInCurrency= '210' , userid = '1', supplierdate = '2025-12-19 00:57:33'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '200.00', '10', '0', 'اضافة فاتورة مشتريات', '6', '210', '2025-12-19 00:57:22', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','200','10','210','0',''); -- id=2
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:28:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:58:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:58: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=290
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:28:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:58:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:58:13', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=291
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:28:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:58:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:58:22', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=292
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944870508026', '2025-12-19 00:58:13', '1', '210.00', '410', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 00:58:22', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=7
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '7', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 00:58:22', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=7
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 00:58:13', 1, 4, 0, 0
                    , 10, 20, 0, 0, 1, '2025-12-19 00:58:22')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 00:58:22' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '7', '', '0', '0'); -- id=6
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 1 WHERE buybilldetailid = 7 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 7;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '7', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1', '21', '1', '2025-12-19 00:58:13','0','0'); -- id=21
UPDATE supplier SET  suppliercurrentDebt = '410',suppliercurrentDebtInCurrency= '410' , userid = '1', supplierdate = '2025-12-19 00:58:22'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '210.00', '200', '0', 'اضافة فاتورة مشتريات', '7', '410', '2025-12-19 00:58:13', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','210','200','410','0',''); -- id=3
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:28:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:58:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:58:24', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=293
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:28:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:58:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:58:31', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=294
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('haxem','','3','10','10','10','10','2025-12-19','0','1','1','','0','0','0','0','0','10','10','10','10','10','0','0','0','0','','0','0','0','0','0','','','0','0','0','','0','0','0','','','','','0','0','0','0','','0','0','','0','','10','10','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0','0','0','0','0','','','0','0','0','0'); -- id=6
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (6, 1,'2025-12-19 00:59:22',1)
                ON DUPLICATE KEY UPDATE productid = 6, edited = 1, sysdate = '2025-12-19 00:59:22', userid = 1; -- id=6
UPDATE product SET productName = 'haxem', productDescription = '', productCatId = '3', productBuyPrice = '10', productSellAllPrice = '10', productSellUnitPrice = '10', productSellHalfPrice = '10', productDate = '2025-12-19', conditions = '0', userId = '1', limitamount = '1', parcode = '00006',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',meanbuyprice_withDiscount = '10' , productbuypricereal = '10' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',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 productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice,unitInTax,proUnitPrice4,proUnitPrice5,proUnitPrice6,proUnitPrice7,proUnitPrice8,proUnitPrice9,proUnitPrice10,proUnitPrice11,proUnitPrice12,proUnitPrice13) VALUES ('1', '6', '1', '2025-12-19', '1', '0','0000601','10','10','10','10','','0','0','0','0','0','0','0','0','0','0'); -- id=6
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('6', '1', '0', '1', '2025-12-19'); -- id=6
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('6', '1', '0', '0', '6', 'إضافة منتج', 'productController.php', '0', '0', '1', '2025-12-19','0','0'); -- id=22
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:29:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:59:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 00:59:33', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=295
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:29:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 00:59:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 00:59:37', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=296
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2025-12-19 01:00:10', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientdebt.php'); -- id=297
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2025-12-19 01:00:10', '1', 'showallajax', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientdebt.php?do=showallajax'); -- id=298
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2025-12-19 01:00:16', '1', 'oneSupplier', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierReportsController.php?do=oneSupplier'); -- id=299
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2025-12-19 01:00:20', '1', 'oneSupplier', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierReportsController.php?do=oneSupplier'); -- id=300
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2025-12-19 01:00:29', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientController.php'); -- id=301
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:32";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 01:00:32', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=302
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 01:00:39', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=303
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:30:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:00:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesTypeController.php', '2025-12-19 01:00:52', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesTypeController.php'); -- id=304
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:31:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:01:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:01:11', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=305
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:31:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:01:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:01:12', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=306
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:31:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:01:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:01:19', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=307
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694487b822bc8', '2025-12-19 01:01:12', '1', '410.00', '420', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:01:19', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=8
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '8', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:01:19', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=8
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:01:12', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:01:19')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:01:19' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '8', '', '0', '0'); -- id=7
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 21 WHERE buybilldetailid = 8 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 8;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '22', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '8', 'اضافة فاتورة مشتريات', 'buyBillController.php', '21', '22', '1', '2025-12-19 01:01:12','0','0'); -- id=23
UPDATE supplier SET  suppliercurrentDebt = '420',suppliercurrentDebtInCurrency= '420' , userid = '1', supplierdate = '2025-12-19 01:01:19'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '410.00', '10', '0', 'اضافة فاتورة مشتريات', '8', '420', '2025-12-19 01:01:12', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','410','10','420','0',''); -- id=4
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:31:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:01:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:01:52', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=308
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:02:02', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=309
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694487e00f4cc', '2025-12-19 01:01:52', '1', '420.00', '430', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:02:02', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=9
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '9', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:02:02', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=9
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:01:52', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:02:02')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:02:02' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '9', '', '0', '0'); -- id=8
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 22 WHERE buybilldetailid = 9 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 9;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '23', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '9', 'اضافة فاتورة مشتريات', 'buyBillController.php', '22', '23', '1', '2025-12-19 01:01:52','0','0'); -- id=24
UPDATE supplier SET  suppliercurrentDebt = '430',suppliercurrentDebtInCurrency= '430' , userid = '1', supplierdate = '2025-12-19 01:02:02'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '420.00', '10', '0', 'اضافة فاتورة مشتريات', '9', '430', '2025-12-19 01:01:52', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','420','10','430','0',''); -- id=5
update buybill set dailyentryid='0,0' where buybillid=9;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2025-12-19 01:02:16', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/storereportController.php'); -- id=310
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2025-12-19 01:02:21', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyreport.php'); -- id=311
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2025-12-19 01:02:22', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientdebt.php'); -- id=312
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientdebt.php', '2025-12-19 01:02:22', '1', 'showallajax', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientdebt.php?do=showallajax'); -- id=313
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2025-12-19 01:02:25', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/storereportController.php'); -- id=314
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2025-12-19 01:02:28', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productController.php?do=show'); -- id=315
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('transfermoneyController.php', '2025-12-19 01:02:30', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/transfermoneyController.php'); -- id=316
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2025-12-19 01:02:30', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientController.php?do=show'); -- id=317
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:02:36', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=318
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:02:38', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=319
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 01:02:41', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=320
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-19 01:02:43', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=321
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2025-12-19 01:02:44', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierPayedDeptController.php'); -- id=322
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:32:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:02:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 01:02:47', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productCatController.php'); -- id=323
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 01:03:01', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=324
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:05', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=325
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:18', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=326
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944882937451', '2025-12-19 01:03:05', '1', '430.00', '440', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:03:18', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=10
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '10', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:03:18', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=10
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:03:05', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:03:18')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:03:18' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '10', '', '0', '0'); -- id=9
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 23 WHERE buybilldetailid = 10 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 10;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '10', 'اضافة فاتورة مشتريات', 'buyBillController.php', '23', '24', '1', '2025-12-19 01:03:05','0','0'); -- id=25
UPDATE supplier SET  suppliercurrentDebt = '440',suppliercurrentDebtInCurrency= '440' , userid = '1', supplierdate = '2025-12-19 01:03:18'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '430.00', '10', '0', 'اضافة فاتورة مشتريات', '10', '440', '2025-12-19 01:03:05', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','430','10','440','0',''); -- id=6
update buybill set dailyentryid='0,0' where buybillid=10;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:52', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=327
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944882937451', '2025-12-19 01:03:05', '1', '440.00', '450', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:03:53', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=11
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '11', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:03:53', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=11
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:03:05', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:03:53')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:03:53' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '11', '', '0', '0'); -- id=10
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 24 WHERE buybilldetailid = 11 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 11;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '11', 'اضافة فاتورة مشتريات', 'buyBillController.php', '24', '25', '1', '2025-12-19 01:03:05','0','0'); -- id=26
UPDATE supplier SET  suppliercurrentDebt = '450',suppliercurrentDebtInCurrency= '450' , userid = '1', supplierdate = '2025-12-19 01:03:53'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '440.00', '10', '0', 'اضافة فاتورة مشتريات', '11', '450', '2025-12-19 01:03:05', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','440','10','450','0',''); -- id=7
update buybill set dailyentryid='0,0' where buybillid=11;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:54', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=328
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:03:54', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:55', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=329
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:03:55', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:56', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=330
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:03:56', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:03:57', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=331
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:33:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:03:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:03:57', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=332
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:06', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=333
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944885de5b87', '2025-12-19 01:03:57', '1', '450.00', '460', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:04:06', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=12
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '12', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:04:06', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=12
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:03:57', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:04:06')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:04:06' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '12', '', '0', '0'); -- id=11
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 25 WHERE buybilldetailid = 12 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 12;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '26', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '12', 'اضافة فاتورة مشتريات', 'buyBillController.php', '25', '26', '1', '2025-12-19 01:03:57','0','0'); -- id=27
UPDATE supplier SET  suppliercurrentDebt = '460',suppliercurrentDebtInCurrency= '460' , userid = '1', supplierdate = '2025-12-19 01:04:06'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '450.00', '10', '0', 'اضافة فاتورة مشتريات', '12', '460', '2025-12-19 01:03:57', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','450','10','460','0',''); -- id=8
update buybill set dailyentryid='0,0' where buybillid=12;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:07', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=334
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:07', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:08', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=335
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:08', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:09', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=336
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:09', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:11', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=337
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:11', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:12', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=338
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:12', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:13', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=339
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:13', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:14', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=340
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:14', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:15', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=341
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:15', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:16', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=342
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:16', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:17', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=343
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:17', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:18', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=344
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:18', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:19', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=345
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:19', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:20', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=346
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:20', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:21', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=347
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:21', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:22', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=348
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:22', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:24', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=349
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:24', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:25', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=350
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:25', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:26', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=351
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:26', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:27', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=352
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:27', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:28', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=353
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:28', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:29', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=354
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:29', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:30', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=355
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:30', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:31', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=356
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:31', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:32";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:32', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=357
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:32', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:33', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=358
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:33', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:34', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=359
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:34', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:35', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=360
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:35', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:36', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=361
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:36', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:38', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=362
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:38', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:39', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=363
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:39', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:40', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=364
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:40', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:41', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=365
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:41', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:42', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=366
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:42', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:43', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=367
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:43', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:44', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=368
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:44', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:45', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=369
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:45', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:46', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=370
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:46', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:47', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=371
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:47', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:48', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=372
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:48', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:04:49', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=373
BEGIN;
INSERT INTO returnbuybill (returnbuybillSerial, returnbuybilldate, returnbuybillsupplierid, returnbuybilltotaldeptbefor, returnbuybilltotaldeptafter, returnbuybilldiscount, returnbuybilldiscountrype, returnbuybilltotalbill, returnbuybillaftertotalbill, returnbuybilltotalpayed, returnbuybillfinalbill, returnbuybillstoreid, returnbuybillsysdate,comment, userid, conditions, returnbuybillclientname, returnbuybillsaveid, billnameid, returnbuybilldirectpayment,payedtax,costcenterid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,client,returnbuybilladdition,returnbuybilladditiontrype) VALUES ('', '', null, '', '0', '', null, '', '0', '0', '0', null, '2025-12-19 01:04:49', '', '1', '0', '', '1', null,'1','0','-1','0','0','0','0','0','0','0');ROLLBACK;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:34:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:04:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:04:50', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=374
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:37:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:07:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:07:48', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=375
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:37:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:07:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:07:54', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=376
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694489448af6a', '2025-12-19 01:07:48', '1', '460.00', '470', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:07:54', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=13
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '13', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:07:54', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=13
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:07:48', 1, 4, 0, 0
                    , 10, 1, 0, 0, 1, '2025-12-19 01:07:54')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:07:54' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '13', '', '0', '0'); -- id=12
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 26 WHERE buybilldetailid = 13 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 13;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '13', 'اضافة فاتورة مشتريات', 'buyBillController.php', '26', '27', '1', '2025-12-19 01:07:48','0','0'); -- id=28
UPDATE supplier SET  suppliercurrentDebt = '470',suppliercurrentDebtInCurrency= '470' , userid = '1', supplierdate = '2025-12-19 01:07:54'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '460.00', '10', '0', 'اضافة فاتورة مشتريات', '13', '470', '2025-12-19 01:07:48', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','460','10','470','0',''); -- id=9
update buybill set dailyentryid='0,0' where buybillid=13;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:38:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:08:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:08:51', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=show'); -- id=377
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:38:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:08:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:08:56', '1', 'details', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=details&id=13'); -- id=378
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:38:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:08:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:08:58', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=show'); -- id=379
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:38:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:08:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:08:59', '1', 'details', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=details&id=12'); -- id=380
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:01', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=show'); -- id=381
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:03', '1', 'details', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=details&id=10'); -- id=382
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:05', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=show'); -- id=383
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:06', '1', 'details', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=details&id=5'); -- id=384
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:08', '1', 'show', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=show'); -- id=385
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:09:13', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=386
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:09:13', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=387
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:14', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=388
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:09:15', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=389
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('expensesController.php', '2025-12-19 01:09:15', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/expensesController.php'); -- id=390
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-19 01:09:16', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=391
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2025-12-19 01:09:17', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierPayedDeptController.php'); -- id=392
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2025-12-19 01:09:18', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/savedailyController.php'); -- id=393
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2025-12-19 01:09:19', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientPayedDeptController.php'); -- id=394
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2025-12-19 01:09:19', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierPayedDeptController.php'); -- id=395
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2025-12-19 01:09:20', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientReportsController.php'); -- id=396
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2025-12-19 01:09:21', '1', 'oneSupplier', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierReportsController.php?do=oneSupplier'); -- id=397
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 01:09:21', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productCatController.php'); -- id=398
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2025-12-19 01:09:22', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productController.php'); -- id=399
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:22";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientController.php', '2025-12-19 01:09:22', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/clientController.php'); -- id=400
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2025-12-19 01:09:23', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/supplierController.php'); -- id=401
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2025-12-19 01:09:24', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/storedetailController.php'); -- id=402
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:39:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:09:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreport.php', '2025-12-19 01:09:24', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/salesreport.php'); -- id=403
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:40:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:10:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:10:12', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=404
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:40:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:10:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:10:13', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=405
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:40:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:10:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:10:29', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=406
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694489d533bc0', '2025-12-19 01:10:13', '1', '470.00', '479', '1', '0', '10.00',  '9', '0', '9', '1', '2025-12-19 01:10:29', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=14
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '14', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:10:29', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=14
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:10:13', 1, 4, 0, 0
                    , 9, 1, 0, 0, 1, '2025-12-19 01:10:29')
                ON DUPLICATE KEY UPDATE buyprice = 9,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:10:29' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '14', '', '0', '0'); -- id=13
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 27 WHERE buybilldetailid = 14 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '9',meanbuyprice = '10',meanbuyprice_withDiscount = '9.96' , 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='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='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='9',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 9, meanbuyprice_withDiscount = 9.96
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 9
                where buybilldetailid = 14;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '14', 'اضافة فاتورة مشتريات', 'buyBillController.php', '27', '28', '1', '2025-12-19 01:10:13','0','0'); -- id=29
UPDATE supplier SET  suppliercurrentDebt = '479',suppliercurrentDebtInCurrency= '479' , userid = '1', supplierdate = '2025-12-19 01:10:29'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '470.00', '9', '0', 'اضافة فاتورة مشتريات', '14', '479', '2025-12-19 01:10:13', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','9','1','470','9','479','0',''); -- id=10
update buybill set dailyentryid='0,0' where buybillid=14;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:40:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:10:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:10:30', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=407
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:42:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:12:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:12:42', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=408
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:42:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:12:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:12:49', '1', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=409

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069448a6a71d0a
-- ----------------------------------------------------------------------------------------------------

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-19 01:12:49', '069448a6a71d0a', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:12:49', '', '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-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=14
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','اضافة فاتورة مبيعات','14', '0', '2025-12-19 01:12:49', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:12:49','0','0','',''); -- id=16
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 ('9','00004', '14', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:12:49', '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=15
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4)
                , userid = 1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
UPDATE sellbilldetail SET  lastbuyprice = 10.00 , meanbuyprice = 10.00, lastbuyprice_withDiscount = 9.00, meanbuyprice_withDiscount = 9.96
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 9
                where sellbilldetailid = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -9, -9.96, -9.99
                    , 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+-9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-9.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -9, -9.96, -9.99
                    , 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+-9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-9.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '14', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '1', '2025-12-19 01:12:49','0','0'); -- id=30
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '870',  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 ('860','10', '0', '1', 'اضافة فاتورة مبيعات', '14', '870', '2025-12-19 01:12:49', '1',  'sellbillController.php','1','','0'); -- id=12
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '1', '0', '0', '2025-12-19 01:12:49','اضافة فاتورة مبيعات رقم 14','1','0',null,'0','14','sellbillController.php?do=showDetail&sellbillid=14'); -- id=21
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('21', '383', '10', '','0'); -- id=21
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '860', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('21', '143', '10', '','0'); -- id=21
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '360', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-9', '-9', '2025-12-19', '1', '0', '0', '2025-12-19 01:12:49','اضافة فاتورة مبيعات رقم 14 - صرف البضاعة من المخزن','1','0',null,'0','14','sellbillController.php?do=showDetail&sellbillid=14'); -- id=22
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('22', '402', '-9', '','0'); -- id=22
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-339', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('22', '382', '-9', '','0'); -- id=22
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10339', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='21,0,22' where sellbillid=14;
 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-19', 10, -10, -10
                    , -10, -9, -9.96, -9.99
                    , 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+-9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-9.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -9, -9.96, -9.99
                    , 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+-9, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+-9.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+-9.99
                            , 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, -9, -9.96, -9.99, -10, -10)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10, netSellCostBuyPrice = netSellCostBuyPrice+-10
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-10
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-10
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-9
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-9.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069448a6a71d0a and sellbillId = 14 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:42:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:12:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:12:49', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=410
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:14:11', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=411
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:14:23', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=412
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069448ac3c4456', '2025-12-19 01:14:11', '1', '479.00', '679', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:14:23', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=15
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '15', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:14:23', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=15
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:14:11', 1, 4, 0, 0
                    , 10, 20, 0, 0, 1, '2025-12-19 01:14:23')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:14:23' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '15', '', '0', '0'); -- id=14
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 15 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 15;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '15', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2025-12-19 01:14:11','0','0'); -- id=31
UPDATE supplier SET  suppliercurrentDebt = '679',suppliercurrentDebtInCurrency= '679' , userid = '1', supplierdate = '2025-12-19 01:14:23'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '479.00', '200', '0', 'اضافة فاتورة مشتريات', '15', '679', '2025-12-19 01:14:11', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','479','200','679','0',''); -- id=11
update buybill set dailyentryid='0,0' where buybillid=15;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:14:24', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=413
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:14:34', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=414
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:14:42', '1', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=415

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069448ada55ad1
-- ----------------------------------------------------------------------------------------------------

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-19 01:14:42', '069448ada55ad1', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:14:42', '', '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-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=15
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','اضافة فاتورة مبيعات','15', '0', '2025-12-19 01:14:42', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:14:42','0','0','',''); -- id=17
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', '15', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:14:42', '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=16
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4)
                , userid = 1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '1', '2025-12-19 01:14:42','0','0'); -- id=32
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '880',  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 ('870','10', '0', '1', 'اضافة فاتورة مبيعات', '15', '880', '2025-12-19 01:14:42', '1',  'sellbillController.php','1','','0'); -- id=13
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '1', '0', '0', '2025-12-19 01:14:42','اضافة فاتورة مبيعات رقم 15','1','0',null,'0','15','sellbillController.php?do=showDetail&sellbillid=15'); -- id=23
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('23', '383', '10', '','0'); -- id=23
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '870', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('23', '143', '10', '','0'); -- id=23
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '370', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '1', '0', '0', '2025-12-19 01:14:42','اضافة فاتورة مبيعات رقم 15 - صرف البضاعة من المخزن','1','0',null,'0','15','sellbillController.php?do=showDetail&sellbillid=15'); -- id=24
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('24', '402', '-10', '','0'); -- id=24
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-349', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('24', '382', '-10', '','0'); -- id=24
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10349', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='23,0,24' where sellbillid=15;
 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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, -9.99, -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+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069448ada55ad1 and sellbillId = 15 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:44:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:14:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:14:42', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=416
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:47:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:17:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2025-12-19 01:17:53', '1', '', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/productCatController.php'); -- id=417
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:47:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:17:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:17:54', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=6'); -- id=418
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:47:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:17:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:17:55', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=419
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:50:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:20:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:20:14', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=420
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:50:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:20:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:20:16', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=421
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:50:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:20:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:20:29', '1', 'add', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=add'); -- id=422
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069448c3018a65', '2025-12-19 01:20:16', '1', '679.00', '879', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:20:29', '', '1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=16
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '16', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:20:29', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=16
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:20:16', 1, 4, 0, 0
                    , 10, 20, 0, 0, 1, '2025-12-19 01:20:29')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2025-12-19 01:20:29' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '16', '', '0', '0'); -- id=15
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 16 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 16;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '16', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2025-12-19 01:20:16','0','0'); -- id=33
UPDATE supplier SET  suppliercurrentDebt = '879',suppliercurrentDebtInCurrency= '879' , userid = '1', supplierdate = '2025-12-19 01:20:29'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '679.00', '200', '0', 'اضافة فاتورة مشتريات', '16', '879', '2025-12-19 01:20:16', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','679','200','879','0',''); -- id=12
update buybill set dailyentryid='0,0' where buybillid=16;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:50:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:20:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:20:30', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=423
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:51:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:21:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:21:01', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=424
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:51:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:21:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:21:08', '1', 'addAndRetuen', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addAndRetuen'); -- id=425

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069448c5d1e47b
-- ----------------------------------------------------------------------------------------------------

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-19 01:21:08', '069448c5d1e47b', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:21:08', '', '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-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=16
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','اضافة فاتورة مبيعات','16', '0', '2025-12-19 01:21:08', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:21:08','0','0','',''); -- id=18
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', '16', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:21:08', '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=17
UPDATE storedetail SET productquantity = (select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4)
                , userid = 1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '16', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '1', '2025-12-19 01:21:08','0','0'); -- id=34
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '890',  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 ('880','10', '0', '1', 'اضافة فاتورة مبيعات', '16', '890', '2025-12-19 01:21:08', '1',  'sellbillController.php','1','','0'); -- id=14
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '1', '0', '0', '2025-12-19 01:21:08','اضافة فاتورة مبيعات رقم 16','1','0',null,'0','16','sellbillController.php?do=showDetail&sellbillid=16'); -- id=25
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('25', '383', '10', '','0'); -- id=25
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '880', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('25', '143', '10', '','0'); -- id=25
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '380', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '1', '0', '0', '2025-12-19 01:21:08','اضافة فاتورة مبيعات رقم 16 - صرف البضاعة من المخزن','1','0',null,'0','16','sellbillController.php?do=showDetail&sellbillid=16'); -- id=26
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('26', '402', '-10', '','0'); -- id=26
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-359', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('26', '382', '-10', '','0'); -- id=26
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10359', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='25,0,26' where sellbillid=16;
 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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, -9.99, -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+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069448c5d1e47b and sellbillId = 16 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:51:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:21:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:21: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=426
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:52:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:22:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:22:40', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=427
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:52:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:22:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2025-12-19 01:22:41', '1', 'addsellBill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=428
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:52:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:22:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2025-12-19 01:22:42', '1', 'bill', '127.0.0.1', 'ba:ed:38:b4:b3:d2', 'DESKTOP','https://localhost/erp19/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=429
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-18 21:53:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:02", 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-18 21:53:02";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:02", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:53", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:53:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:23:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:54:01";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:24:01", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:54:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:24:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:54:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:24:24", deviceType = "MOBILE" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 21:54:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:24:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:27", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069448eff2a70c', '2025-12-19 01:32:15', '1', '879.00', '1079', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:32:27', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=17
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '17', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:32:27', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=17
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:32:15', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:32:27')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:32:27' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '17', '', '0', '0'); -- id=16
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 17 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 17;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '17', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:32:15','0','0'); -- id=35
UPDATE supplier SET  suppliercurrentDebt = '1079',suppliercurrentDebtInCurrency= '1079' , userid = '-1', supplierdate = '2025-12-19 01:32:27'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '879.00', '200', '0', 'اضافة فاتورة مشتريات', '17', '1079', '2025-12-19 01:32:15', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','879','200','1079','0',''); -- id=13
update buybill set dailyentryid='0,0' where buybillid=17;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:35", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 069448f0dad332
-- ----------------------------------------------------------------------------------------------------

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-19 01:32:35', '069448f0dad332', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:32:35', '', '-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-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=17
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','اضافة فاتورة مبيعات','17', '0', '2025-12-19 01:32:35', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:32:35','0','0','',''); -- id=19
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', '17', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:32:35', '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=18
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '17', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:32:35','0','0'); -- id=36
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '900',  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 ('890','10', '0', '1', 'اضافة فاتورة مبيعات', '17', '900', '2025-12-19 01:32:35', '-1',  'sellbillController.php','1','','0'); -- id=15
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:32:35','اضافة فاتورة مبيعات رقم 17','1','0',null,'0','17','sellbillController.php?do=showDetail&sellbillid=17'); -- id=27
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('27', '383', '10', '','0'); -- id=27
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '890', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('27', '143', '10', '','0'); -- id=27
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '390', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:32:35','اضافة فاتورة مبيعات رقم 17 - صرف البضاعة من المخزن','1','0',null,'0','17','sellbillController.php?do=showDetail&sellbillid=17'); -- id=28
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('28', '402', '-10', '','0'); -- id=28
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-369', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('28', '382', '-10', '','0'); -- id=28
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10369', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='27,0,28' where sellbillid=17;
 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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, -9.99, -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+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 069448f0dad332 and sellbillId = 17 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:02:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:32:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:03:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:33:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:03:31";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:33:31", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:03:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:33:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:03:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:33:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:03:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:33:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:04:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:34:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:04:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:34:27", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069448f78d3409', '2025-12-19 01:34:16', '1', '1079.00', '1279', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:34:27', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=18
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '18', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:34:27', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=18
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:34:16', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:34:27')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:34:27' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '18', '', '0', '0'); -- id=17
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 18 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 18;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '18', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:34:16','0','0'); -- id=37
UPDATE supplier SET  suppliercurrentDebt = '1279',suppliercurrentDebtInCurrency= '1279' , userid = '-1', supplierdate = '2025-12-19 01:34:27'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1079.00', '200', '0', 'اضافة فاتورة مشتريات', '18', '1279', '2025-12-19 01:34:16', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','1079','200','1279','0',''); -- id=14
update buybill set dailyentryid='0,0' where buybillid=18;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:04:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:34:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:11:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:41:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:11:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:41:33", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('069449120e8961', '2025-12-19 01:41:20', '1', '1279.00', '1479', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:41:33', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=19
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '19', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:41:33', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=19
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:41:20', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:41:33')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:41:33' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '19', '', '0', '0'); -- id=18
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 20 WHERE buybilldetailid = 19 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 19;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '40', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '19', 'اضافة فاتورة مشتريات', 'buyBillController.php', '20', '40', '-1', '2025-12-19 01:41:20','0','0'); -- id=38
UPDATE supplier SET  suppliercurrentDebt = '1479',suppliercurrentDebtInCurrency= '1479' , userid = '-1', supplierdate = '2025-12-19 01:41:33'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1279.00', '200', '0', 'اضافة فاتورة مشتريات', '19', '1479', '2025-12-19 01:41:20', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','1279','200','1479','0',''); -- id=15
update buybill set dailyentryid='0,0' where buybillid=19;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:11:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:41:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:13:34";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:43:34", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:13:39";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:43:39", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694491a65c9d8
-- ----------------------------------------------------------------------------------------------------

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-19 01:43:39', '0694491a65c9d8', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:43:39', '', '-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-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=18
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','اضافة فاتورة مبيعات','18', '0', '2025-12-19 01:43:39', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:43:39','0','0','',''); -- id=20
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', '18', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:43:39', '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=19
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '18', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:43:40','0','0'); -- id=39
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '910',  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 ('900','10', '0', '1', 'اضافة فاتورة مبيعات', '18', '910', '2025-12-19 01:43:40', '-1',  'sellbillController.php','1','','0'); -- id=16
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:43:40','اضافة فاتورة مبيعات رقم 18','1','0',null,'0','18','sellbillController.php?do=showDetail&sellbillid=18'); -- id=29
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('29', '383', '10', '','0'); -- id=29
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '900', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('29', '143', '10', '','0'); -- id=29
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '400', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:43:40','اضافة فاتورة مبيعات رقم 18 - صرف البضاعة من المخزن','1','0',null,'0','18','sellbillController.php?do=showDetail&sellbillid=18'); -- id=30
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('30', '402', '-10', '','0'); -- id=30
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-379', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('30', '382', '-10', '','0'); -- id=30
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10379', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='29,0,30' where sellbillid=18;
 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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, -9.99, -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+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 0694491a65c9d8 and sellbillId = 18 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:13:40";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:43:40", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:14:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:44:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:14:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:44:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:12";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:12", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694491fad4f86', '2025-12-19 01:44:58', '1', '1479.00', '1489', '0', '0', '10.00',  '10', '0', '10', '1', '2025-12-19 01:45:12', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=20
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '20', '3', '4', '1', '10', '10.00', '0', '', '2025-12-19 01:45:12', '4','','','0','0','0','0','0',null,'10','10','0','0','0','0','0','0','0','0','1'); -- id=20
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:44:58', 1, 4, 0, 0
                    , 10, 1, 0, 0, -1, '2025-12-19 01:45:12')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:45:12' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '1', '0', 'buyBillController.php', '20', '', '0', '0'); -- id=19
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 20 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 20;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '1', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '0', '20', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '-1', '2025-12-19 01:44:58','0','0'); -- id=40
UPDATE supplier SET  suppliercurrentDebt = '1489',suppliercurrentDebtInCurrency= '1489' , userid = '-1', supplierdate = '2025-12-19 01:45:12'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1479.00', '10', '0', 'اضافة فاتورة مشتريات', '20', '1489', '2025-12-19 01:44:58', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','10','1','1479','10','1489','0',''); -- id=16
update buybill set dailyentryid='0,0' where buybillid=20;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:13";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:13", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:26";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:26", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:36", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:45";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:45", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694492204c6c9', '2025-12-19 01:45:36', '1', '1489.00', '1689', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:45:45', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=21
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '21', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:45:45', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=21
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:45:36', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:45:45')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:45:45' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '21', '', '0', '0'); -- id=20
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 1 WHERE buybilldetailid = 21 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 21;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '21', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '21', 'اضافة فاتورة مشتريات', 'buyBillController.php', '1', '21', '-1', '2025-12-19 01:45:36','0','0'); -- id=41
UPDATE supplier SET  suppliercurrentDebt = '1689',suppliercurrentDebtInCurrency= '1689' , userid = '-1', supplierdate = '2025-12-19 01:45:45'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1489.00', '200', '0', 'اضافة فاتورة مشتريات', '21', '1689', '2025-12-19 01:45:36', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','1489','200','1689','0',''); -- id=17
update buybill set dailyentryid='0,0' where buybillid=21;
COMMIT;
UPDATE product SET overAllAveragePrice = 9.99 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:52", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06944922b38bc9
-- ----------------------------------------------------------------------------------------------------

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-19 01:45:52', '06944922b38bc9', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:45:52', '', '-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-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=19
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','اضافة فاتورة مبيعات','19', '0', '2025-12-19 01:45:52', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:45:52','0','0','',''); -- id=21
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', '19', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:45:52', '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=20
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '19', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:45:52','0','0'); -- id=42
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '920',  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 ('910','10', '0', '1', 'اضافة فاتورة مبيعات', '19', '920', '2025-12-19 01:45:52', '-1',  'sellbillController.php','1','','0'); -- id=17
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:45:52','اضافة فاتورة مبيعات رقم 19','1','0',null,'0','19','sellbillController.php?do=showDetail&sellbillid=19'); -- id=31
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('31', '383', '10', '','0'); -- id=31
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '910', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('31', '143', '10', '','0'); -- id=31
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '410', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:45:52','اضافة فاتورة مبيعات رقم 19 - صرف البضاعة من المخزن','1','0',null,'0','19','sellbillController.php?do=showDetail&sellbillid=19'); -- id=32
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('32', '402', '-10', '','0'); -- id=32
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-389', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('32', '382', '-10', '','0'); -- id=32
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10389', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='31,0,32' where sellbillid=19;
 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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-19', 10, -10, -10
                    , -10, -10, -10, -9.99
                    , 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+-9.99
                            , 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, -9.99, -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+-9.99
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-10
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-10;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06944922b38bc9 and sellbillId = 19 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:15:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:45:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:18", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694492b693be7', '2025-12-19 01:48:06', '1', '1689.00', '1889', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:48:18', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=22
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '22', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:48:18', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=22
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:48:06', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:48:18')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:48:18' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '22', '', '0', '0'); -- id=21
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 22 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='9.99',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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 22;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '22', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:48:06','0','0'); -- id=43
UPDATE supplier SET  suppliercurrentDebt = '1889',suppliercurrentDebtInCurrency= '1889' , userid = '-1', supplierdate = '2025-12-19 01:48:18'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1689.00', '200', '0', 'اضافة فاتورة مشتريات', '22', '1889', '2025-12-19 01:48:06', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','1689','200','1889','0',''); -- id=18
update buybill set dailyentryid='0,0' where buybillid=22;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:28", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694492c3beedf
-- ----------------------------------------------------------------------------------------------------

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-19 01:48:28', '0694492c3beedf', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:48:28', '', '-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-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=20
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','اضافة فاتورة مبيعات','20', '0', '2025-12-19 01:48:28', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:48:28','0','0','',''); -- id=22
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', '20', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:48:28', '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=21
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '20', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:48:28','0','0'); -- id=44
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '930',  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 ('920','10', '0', '1', 'اضافة فاتورة مبيعات', '20', '930', '2025-12-19 01:48:28', '-1',  'sellbillController.php','1','','0'); -- id=18
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:48:28','اضافة فاتورة مبيعات رقم 20','1','0',null,'0','20','sellbillController.php?do=showDetail&sellbillid=20'); -- id=33
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('33', '383', '10', '','0'); -- id=33
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '920', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('33', '143', '10', '','0'); -- id=33
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '420', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:48:28','اضافة فاتورة مبيعات رقم 20 - صرف البضاعة من المخزن','1','0',null,'0','20','sellbillController.php?do=showDetail&sellbillid=20'); -- id=34
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('34', '402', '-10', '','0'); -- id=34
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-399', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('34', '382', '-10', '','0'); -- id=34
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10399', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='33,0,34' where sellbillid=20;
 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-19', 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-19', 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 0694492c3beedf and sellbillId = 20 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:18:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:48:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:04";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:04", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:14", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944941df1dec', '2025-12-19 01:54:05', '1', '1889.00', '2089', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:54:14', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=23
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '23', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:54:14', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=23
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:54:05', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:54:14')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:54:14' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '23', '', '0', '0'); -- id=22
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 23 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 23;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '23', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:54:05','0','0'); -- id=45
UPDATE supplier SET  suppliercurrentDebt = '2089',suppliercurrentDebtInCurrency= '2089' , userid = '-1', supplierdate = '2025-12-19 01:54:14'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '1889.00', '200', '0', 'اضافة فاتورة مشتريات', '23', '2089', '2025-12-19 01:54:05', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','1889','200','2089','0',''); -- id=19
update buybill set dailyentryid='0,0' where buybillid=23;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:24", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694494280c440
-- ----------------------------------------------------------------------------------------------------

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-19 01:54:24', '0694494280c440', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:54:24', '', '-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-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=21
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','اضافة فاتورة مبيعات','21', '0', '2025-12-19 01:54:24', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:54:24','0','0','',''); -- id=23
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', '21', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:54:24', '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=22
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '21', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:54:24','0','0'); -- id=46
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '940',  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 ('930','10', '0', '1', 'اضافة فاتورة مبيعات', '21', '940', '2025-12-19 01:54:24', '-1',  'sellbillController.php','1','','0'); -- id=19
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:54:24','اضافة فاتورة مبيعات رقم 21','1','0',null,'0','21','sellbillController.php?do=showDetail&sellbillid=21'); -- id=35
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('35', '383', '10', '','0'); -- id=35
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '930', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('35', '143', '10', '','0'); -- id=35
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '430', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:54:24','اضافة فاتورة مبيعات رقم 21 - صرف البضاعة من المخزن','1','0',null,'0','21','sellbillController.php?do=showDetail&sellbillid=21'); -- id=36
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('36', '402', '-10', '','0'); -- id=36
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-409', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('36', '382', '-10', '','0'); -- id=36
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10409', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='35,0,36' where sellbillid=21;
 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-19', 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-19', 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 0694494280c440 and sellbillId = 21 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:24:24";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:54:24", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:37", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694494ac89275', '2025-12-19 01:56:28', '1', '2089.00', '2289', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:56:37', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=24
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '24', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:56:37', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=24
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:56:28', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:56:37')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:56:37' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '24', '', '0', '0'); -- id=23
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 24 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 24;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '24', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:56:28','0','0'); -- id=47
UPDATE supplier SET  suppliercurrentDebt = '2289',suppliercurrentDebtInCurrency= '2289' , userid = '-1', supplierdate = '2025-12-19 01:56:37'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '2089.00', '200', '0', 'اضافة فاتورة مشتريات', '24', '2289', '2025-12-19 01:56:28', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','2089','200','2289','0',''); -- id=20
update buybill set dailyentryid='0,0' where buybillid=24;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:44", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694494b6b7054
-- ----------------------------------------------------------------------------------------------------

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-19 01:56:44', '0694494b6b7054', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:56:44', '', '-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-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=22
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','اضافة فاتورة مبيعات','22', '0', '2025-12-19 01:56:44', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:56:44','0','0','',''); -- id=24
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', '22', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:56:44', '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=23
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '22', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:56:44','0','0'); -- id=48
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '950',  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 ('940','10', '0', '1', 'اضافة فاتورة مبيعات', '22', '950', '2025-12-19 01:56:44', '-1',  'sellbillController.php','1','','0'); -- id=20
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:56:44','اضافة فاتورة مبيعات رقم 22','1','0',null,'0','22','sellbillController.php?do=showDetail&sellbillid=22'); -- id=37
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('37', '383', '10', '','0'); -- id=37
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '940', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('37', '143', '10', '','0'); -- id=37
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '440', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:56:44','اضافة فاتورة مبيعات رقم 22 - صرف البضاعة من المخزن','1','0',null,'0','22','sellbillController.php?do=showDetail&sellbillid=22'); -- id=38
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('38', '402', '-10', '','0'); -- id=38
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-419', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('38', '382', '-10', '','0'); -- id=38
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10419', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='37,0,38' where sellbillid=22;
 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-19', 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-19', 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 0694494b6b7054 and sellbillId = 22 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:26:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:56:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:28:05";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:58:05", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:28:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:58:11", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06944950e01020
-- ----------------------------------------------------------------------------------------------------

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-19 01:58:11', '06944950e01020', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 01:58:11', '', '-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-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=23
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','اضافة فاتورة مبيعات','23', '0', '2025-12-19 01:58:11', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 01:58:11','0','0','',''); -- id=25
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', '23', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 01:58:11', '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=24
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '23', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 01:58:11','0','0'); -- id=49
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '960',  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 ('950','10', '0', '1', 'اضافة فاتورة مبيعات', '23', '960', '2025-12-19 01:58:11', '-1',  'sellbillController.php','1','','0'); -- id=21
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:58:11','اضافة فاتورة مبيعات رقم 23','1','0',null,'0','23','sellbillController.php?do=showDetail&sellbillid=23'); -- id=39
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('39', '383', '10', '','0'); -- id=39
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '950', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('39', '143', '10', '','0'); -- id=39
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '450', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 01:58:11','اضافة فاتورة مبيعات رقم 23 - صرف البضاعة من المخزن','1','0',null,'0','23','sellbillController.php?do=showDetail&sellbillid=23'); -- id=40
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('40', '402', '-10', '','0'); -- id=40
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-429', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('40', '382', '-10', '','0'); -- id=40
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10429', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='39,0,40' where sellbillid=23;
 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-19', 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-19', 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 06944950e01020 and sellbillId = 23 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:28:11";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:58:11", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:29:42";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:59:42", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:29:53";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:59:53", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06944956e8e8d7', '2025-12-19 01:59:42', '1', '2289.00', '2489', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 01:59:53', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=25
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '25', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 01:59:53', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=25
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 01:59:42', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 01:59:53')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 01:59:53' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '25', '', '0', '0'); -- id=24
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 25 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 25;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '25', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 01:59:42','0','0'); -- id=50
UPDATE supplier SET  suppliercurrentDebt = '2489',suppliercurrentDebtInCurrency= '2489' , userid = '-1', supplierdate = '2025-12-19 01:59:53'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '2289.00', '200', '0', 'اضافة فاتورة مشتريات', '25', '2489', '2025-12-19 01:59:42', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','2289','200','2489','0',''); -- id=21
update buybill set dailyentryid='0,0' where buybillid=25;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:29:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:59:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:29:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 01:59:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:30:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:00:00", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06944957b42fb7
-- ----------------------------------------------------------------------------------------------------

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-19 02:00:00', '06944957b42fb7', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 02:00:00', '', '-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-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=24
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','اضافة فاتورة مبيعات','24', '0', '2025-12-19 02:00:00', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 02:00:00','0','0','',''); -- id=26
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', '24', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 02:00:00', '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=25
UPDATE storedetail SET productquantity = COALESCE((select sum(`quantity`) from sizecolorstoredetail where `storeid` = 1 and `productid` = 4), 0)
                , userid = -1, storedetaildate = "2025-12-19" WHERE  unittype = 0 and storedetailid = 4 ;
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 = 4;
 INSERT INTO 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-19', 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-19', 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 storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '24', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0', '-1', '-1', '2025-12-19 02:00:00','0','0'); -- id=51
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '970',  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 ('960','10', '0', '1', 'اضافة فاتورة مبيعات', '24', '970', '2025-12-19 02:00:00', '-1',  'sellbillController.php','1','','0'); -- id=22
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:00:00','اضافة فاتورة مبيعات رقم 24','1','0',null,'0','24','sellbillController.php?do=showDetail&sellbillid=24'); -- id=41
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('41', '383', '10', '','0'); -- id=41
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '960', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('41', '143', '10', '','0'); -- id=41
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '460', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '-10', '-10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:00:00','اضافة فاتورة مبيعات رقم 24 - صرف البضاعة من المخزن','1','0',null,'0','24','sellbillController.php?do=showDetail&sellbillid=24'); -- id=42
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('42', '402', '-10', '','0'); -- id=42
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-439', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('42', '382', '-10', '','0'); -- id=42
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10439', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='41,0,42' where sellbillid=24;
 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-19', 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-19', 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 06944957b42fb7 and sellbillId = 24 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:30:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:00:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:30:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:00:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:30:56";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:00:56", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:06", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,payedtax,costcenterid,dailyentryid,delbyuserid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('0694495b8d11ee', '2025-12-19 02:00:56', '1', '2489.00', '2689', '0', '0', '200.00',  '200', '0', '200', '1', '2025-12-19 02:01:06', '', '-1', '0', '', '1','1','1','0','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=26
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('00004', '26', '3', '4', '20', '10', '200.00', '0', '', '2025-12-19 02:01:06', '4','','','0','0','0','0','0',null,'10','200','0','0','0','0','0','0','0','0','1'); -- id=26
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2025-12-19 02:00:56', 1, 4, 0, 0
                    , 10, 20, 0, 0, -1, '2025-12-19 02:01:06')
                ON DUPLICATE KEY UPDATE buyprice = 10,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = -1,sysDate = '2025-12-19 02:01:06' ; -- id=3
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('4', '10', '20', '0', 'buyBillController.php', '26', '', '0', '0'); -- id=25
UPDATE product SET  productBuyPrice = "10" WHERE productId = 4 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 26 ;
UPDATE product SET productName = 'new prod1', productDescription = '', productCatId = '3', productBuyPrice = '10.00', productSellAllPrice = '10.00', productSellUnitPrice = '10.00', productSellHalfPrice = '10.00', productDate = '2025-12-09', conditions = '0', userId = '1', limitamount = '0', parcode = '00004',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '10',lastbuyprice_withDiscount = '10',meanbuyprice = '10',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='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='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='-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 = '4';
UPDATE buybilldetail SET  lastbuyprice = 10 , meanbuyprice = 10, lastbuyprice_withDiscount = 10, meanbuyprice_withDiscount = 10
        , lastbuyprice_withTax = 10, meanbuyprice_withTax = 10, lastbuyprice_withDiscountAndTax = 10
                where buybilldetailid = 26;
UPDATE productunit SET proUnitBuyPrice  = 10 * productnumber WHERE productid = 4;
UPDATE storedetail SET  productquantity = '20', userid = '-1', storedetaildate = '2025-12-19' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '20', '0', '26', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '-1', '2025-12-19 02:00:56','0','0'); -- id=52
UPDATE supplier SET  suppliercurrentDebt = '2689',suppliercurrentDebtInCurrency= '2689' , userid = '-1', supplierdate = '2025-12-19 02:01:06'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '2489.00', '200', '0', 'اضافة فاتورة مشتريات', '26', '2689', '2025-12-19 02:00:56', '-1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','200','1','2489','200','2689','0',''); -- id=22
update buybill set dailyentryid='0,0' where buybillid=26;
COMMIT;
UPDATE product SET overAllAveragePrice = 10 WHERE productId = 4;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:16", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694495c681cb7
-- ----------------------------------------------------------------------------------------------------

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-19 02:01:16', '0694495c681cb7', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 02:01:16', '', '-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-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=25
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','اضافة فاتورة مبيعات','25', '0', '2025-12-19 02:01:16', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 02:01:16','0','0','',''); -- id=27
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', '25', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 02:01: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=26
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 = 26;
 INSERT INTO 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-19', 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-19', 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 = '19', userid = '-1', storedetaildate = '2025-12-19 02:01: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', '25', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '19', '-1', '2025-12-19 02:01:16','0','0'); -- id=53
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '980',  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 ('970','10', '0', '1', 'اضافة فاتورة مبيعات', '25', '980', '2025-12-19 02:01:16', '-1',  'sellbillController.php','1','','0'); -- id=23
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:01:16','اضافة فاتورة مبيعات رقم 25','1','0',null,'0','25','sellbillController.php?do=showDetail&sellbillid=25'); -- id=43
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('43', '383', '10', '','0'); -- id=43
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '970', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('43', '143', '10', '','0'); -- id=43
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '470', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:01:16','اضافة فاتورة مبيعات رقم 25 - صرف البضاعة من المخزن','1','0',null,'0','25','sellbillController.php?do=showDetail&sellbillid=25'); -- id=44
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('44', '402', '10', '','0'); -- id=44
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-429', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('44', '382', '10', '','0'); -- id=44
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10429', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='43,0,44' where sellbillid=25;
 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-19', 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-19', 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 0694495c681cb7 and sellbillId = 25 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:21", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 0694495cc1f021
-- ----------------------------------------------------------------------------------------------------

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-19 02:01:21', '0694495cc1f021', '1', '0.00', '0', '0', '1', '10.00', '10', '10', '0', '1', '2025-12-19 02:01:21', '', '-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-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=26
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','اضافة فاتورة مبيعات','26', '0', '2025-12-19 02:01:21', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10', '0', null, '0', null, null,'', '0','1','1','0','1','2025-12-19 02:01:21','0','0','',''); -- id=28
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', '26', '3', '4', '1', '10', '10', '0', '', '0', '2025-12-19 02:01:21', '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=27
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 = 27;
 INSERT INTO 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-19', 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-19', 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 = '18', userid = '-1', storedetaildate = '2025-12-19 02:01:21' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '1', '1', '26', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19', '18', '-1', '2025-12-19 02:01:21','0','0'); -- id=54
CALL saveInUse(1,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '990',  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 ('980','10', '0', '1', 'اضافة فاتورة مبيعات', '26', '990', '2025-12-19 02:01:21', '-1',  'sellbillController.php','1','','0'); -- id=24
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:01:21','اضافة فاتورة مبيعات رقم 26','1','0',null,'0','26','sellbillController.php?do=showDetail&sellbillid=26'); -- id=45
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('45', '383', '10', '','0'); -- id=45
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '980', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('45', '143', '10', '','0'); -- id=45
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '480', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10', '10', '2025-12-19', '-1', '0', '0', '2025-12-19 02:01:21','اضافة فاتورة مبيعات رقم 26 - صرف البضاعة من المخزن','1','0',null,'0','26','sellbillController.php?do=showDetail&sellbillid=26'); -- id=46
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('46', '402', '10', '','0'); -- id=46
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-419', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('46', '382', '10', '','0'); -- id=46
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10419', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='45,0,46' where sellbillid=26;
 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-19', 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-19', 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 0694495cc1f021 and sellbillId = 26 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 22:31:21";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:01:21", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:17", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:18";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:20";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:20", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:28";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:28", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:01:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:31:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:02:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:32:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:02:25";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 02:32:25", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:07";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:07", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:09";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:09", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:19", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:34:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:04:44", deviceType = "DESKTOP" WHERE userid = -1;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06944a4938f8f6
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);

-- ----------------------------------------------------------------------------------------------------
-- force free client=2 with redbean
-- ----------------------------------------------------------------------------------------------------

CALL clientInUse(2,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2025-12-19 03:04:44', '06944a4938f8f6', '2', '-500.00', '-470', '0', '1', '30.00', '30', '0', '30', '1', '2025-12-19 03:05:00', '', '-1', '0', 'hazem', '1', '1', '3', '0', ' hazem', '3' ,'0','','','','','-1','0','0','0','0','0','30','0','','0','0','0','0','0','0','0','0','0','0','0','','','','0','','0','','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=27
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','-500.00','30','0','اضافة فاتورة مبيعات','27', '-470', '2025-12-19 03:05:00', '-1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '30', '0', null, '0', null, null,'', '0','1','1','30','1','2025-12-19 03:04:44','0','0','',''); -- id=29
UPDATE client SET  inUse = 0 where clientid = 2;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 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', '27', '3', '4', '3', '10', '30', '0', '', '0', '2025-12-19 03:05:00', '4', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','3-3,','1','1','0','0','10','30','0','','0','0.00','0','0','0','0'); -- id=28
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-19', 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-19', 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 = '15', userid = '-1', storedetaildate = '2025-12-19 03:05:00' WHERE storedetailid = '4';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('4', '1', '3', '1', '27', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '15', '-1', '2025-12-19 03:05:00','0','0'); -- id=55
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30', '30', '2025-12-19', '-1', '0', '0', '2025-12-19 03:05:00','اضافة فاتورة مبيعات رقم 27','1','0',null,'0','27','sellbillController.php?do=showDetail&sellbillid=27'); -- id=47
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('47', '419', '30', '','0'); -- id=47
UPDATE accountstree SET name = 'hazem', customName = 'hazem', customNameEn = 'hazem', nameEn = 'hazem', parent = '58', accountNature = '0', theValue = '-470', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2025-12-09 02:26:26' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('47', '143', '30', '','0'); -- id=47
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '510', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30', '30', '2025-12-19', '-1', '0', '0', '2025-12-19 03:05:00','اضافة فاتورة مبيعات رقم 27 - صرف البضاعة من المخزن','1','0',null,'0','27','sellbillController.php?do=showDetail&sellbillid=27'); -- id=48
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('48', '402', '30', '','0'); -- id=48
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '-389', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('48', '382', '30', '','0'); -- id=48
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '10389', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='47,0,48' where sellbillid=27;
 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-19', 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-19', 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;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06944a4938f8f6 and sellbillId = 27 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-18 23:35:00";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 03:05:00", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:15";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:15", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:17";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:17", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:23";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:23", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:29";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:29", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:43", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:48";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:48", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:50";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:50", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET username = 'GT4', password = '456', usergroupid = '-1', employeename = 'GT4', currentdate = '2025-12-08', conditions = '0', saveid = '1'  , userstoreid ='0' ,awardrate = '0.00' ,searchinonesave = '0', branchId = '0', question = 'what is', answer = 'my company is GT4',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='0',empid='0',obygyDoctorId = '0',lang = 'en',viewclients = '1',viewbills = '1',storeSupervisor='1',storeSupervisorStores='1',projectids='0',bankids='0',saveids='0',searchinonestorebalance='0',storeids='0',webApiId='0',closeSavid='0',charityids='0',laterNakdiUserIds='0',awardrategomla = '0',awardratehalf = '0', dellaternakdipayed='0' WHERE userid = '-1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:52";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:52", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:54";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET username = 'GT4', password = '456', usergroupid = '-1', employeename = 'GT4', currentdate = '2025-12-08', conditions = '0', saveid = '1'  , userstoreid ='0' ,awardrate = '0.00' ,searchinonesave = '0', branchId = '0', question = 'what is', answer = 'my company is GT4',blockedByLimits = '0',directSaveBills = '0',userstoreidDef='0',empid='0',obygyDoctorId = '0',lang = 'ar',viewclients = '1',viewbills = '1',storeSupervisor='1',storeSupervisorStores='1',projectids='0',bankids='0',saveids='0',searchinonestorebalance='0',storeids='0',webApiId='0',closeSavid='0',charityids='0',laterNakdiUserIds='0',awardrategomla = '0',awardratehalf = '0', dellaternakdipayed='0' WHERE userid = '-1';
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:43:57";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:13:57", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:33", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:35";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:35", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:37";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:37", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:38";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:38", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:41";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:41", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:44";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:44", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:46";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:46", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:47", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:44:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:14:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:45:03";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:15:03", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:45:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:15:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:45:27";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:15:27", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:30";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:30", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:36";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:36", deviceType = "DESKTOP" WHERE userid = -1;
BEGIN;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:49";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:49", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:51";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:51", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:58";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:58", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:47:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:17:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:48:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:18:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:48:08";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:18:08", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 13:48:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:18:17", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:06";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:06", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:33";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:33", deviceType = "DESKTOP" WHERE userid = -1;
INSERT INTO newdbbackup (backupname, backupdate) VALUES ('new', '2025-12-19 17:56:33'); -- id=1
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:43";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:43", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:47";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:47", deviceType = "DESKTOP" WHERE userid = -1;
INSERT INTO newdbbackup (backupname, backupdate) VALUES ('jkhkjh', '2025-12-19 17:56:47'); -- id=2
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:55";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:55", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:26:59";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:56:59", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:27:10";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:57:10", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:27:14";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:57:14", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:27:16";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:57:16", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2025-12-19 14:27:19";
UPDATE user SET loginip = "127.0.0.1", lastactivetime = "2025-12-19 17:57:19", deviceType = "DESKTOP" WHERE userid = -1;
