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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad99a746e11c
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad99a746e11c and sellbillId = 1208 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:46:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:16:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:16:53', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17201
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:04";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:21:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 08:21:23', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17202
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:23";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 08:21:23', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17203
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:21:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:21:30', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17204
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:21:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:21:59', '5', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=17205
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('الشايب','2026-10-22','','93', '5','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=207
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (207, 1,'2026-10-22 08:21:59',5)
                ON DUPLICATE KEY UPDATE catid = 207, edited = 1, sysdate = '2026-10-22 08:21:59', userid = 5; -- id=222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:51:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:21:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:21:59', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=17206
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:52:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:22:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:22:01', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=17207
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:52:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:22:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:22:02', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17208
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:52:29";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:53:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:23:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:23:53', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17209
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 450 الشايب ','','207','430','450','0','0','2026-10-22','0','5','0','','0','0','0','0','0','430','430','430','430','430','0','4.65','0','0','.','0','0','0','430','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','430','430','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','430','0','0','0','0','0','0','','','0','0','0','0'); -- id=2380
UPDATE product SET productName = 'موديل 450 الشايب ', productDescription = '', productCatId = '207', productBuyPrice = '430', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02380',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '4.65' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2380';
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', '2380', '1', '2026-10-22', '5', '0','0238001','450','0','0','430','','0','0','0','0','0','0','0','0','0','0'); -- id=2380
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2380', '1', '0', '5', '2026-10-22'); -- id=3774
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '0', '0', '2380', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16296
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2380, 1,'2026-10-22 08:23:53',5)
                ON DUPLICATE KEY UPDATE productid = 2380, edited = 1, sysdate = '2026-10-22 08:23:53', userid = 5; -- id=3555
UPDATE product SET productName = 'موديل 450 الشايب ', productDescription = '', productCatId = '207', productBuyPrice = '430.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02380',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '4.65' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2380';
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 ('موديل 470 الشايب','','207','450','470','0','0','2026-10-22','0','5','0','','0','0','0','0','0','450','450','450','450','450','0','4.44','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2381
UPDATE product SET productName = 'موديل 470 الشايب', productDescription = '', productCatId = '207', productBuyPrice = '450', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02381',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2381';
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', '2381', '1', '2026-10-22', '5', '0','0238101','470','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2381
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2381', '1', '0', '5', '2026-10-22'); -- id=3775
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '0', '0', '2381', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16297
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2381, 1,'2026-10-22 08:23:53',5)
                ON DUPLICATE KEY UPDATE productid = 2381, edited = 1, sysdate = '2026-10-22 08:23:53', userid = 5; -- id=3556
UPDATE product SET productName = 'موديل 470 الشايب', productDescription = '', productCatId = '207', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02381',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2381';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:53:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:23:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:23:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17210
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:53:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:23:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:23:56', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17211
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:53:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:23:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:23:59', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17212
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:54:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:24:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:24:10', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17213
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:54:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:24:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:24:46', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17214
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 ('06ad99dfaecfc4', '2026-10-22 08:24:10', '1', '-3150.00', '436850', '0', '0', '440000.00',  '440000.00', '', '440000', '1', '2026-10-22 08:24:46', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=310
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 ('02380', '310', '207', '2380', '500', '430', '215000.00', '0', '', '2026-10-22 08:24:46', '2380','','','0','0','0','0','0',null,'430','215000','0','0','0','0','0','0','0','0','1'); -- id=1710
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2380, 0, 0
                    , 430, 500, 0, 0, 5, '2026-10-22 08:24:46')
                ON DUPLICATE KEY UPDATE buyprice = 430,
                        buyQuantity =buyQuantity+500, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:24:46' ; -- id=7031
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2380', '430', '500', '0', 'buyBillController.php', '1710', '', '0', '0'); -- id=1259
UPDATE product SET  productBuyPrice = "430" WHERE productId = 2380 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1710 ;
UPDATE product SET productName = 'موديل 450 الشايب ', productDescription = '', productCatId = '207', productBuyPrice = '430.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02380',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.65' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2380';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 430, meanbuyprice_withDiscount = 430
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where buybilldetailid = 1710;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 2380;
UPDATE storedetail SET  productquantity = '500', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '500', '0', '310', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '500', '5', '2026-10-22 08:24:10','0','0'); -- id=16298
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 ('02381', '310', '207', '2381', '500', '450', '225000.00', '0', '', '2026-10-22 08:24:46', '2381','','','0','0','0','0','0',null,'450','225000','0','0','0','0','0','0','0','0','1'); -- id=1711
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2381, 0, 0
                    , 450, 500, 0, 0, 5, '2026-10-22 08:24:46')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+500, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:24:46' ; -- id=7032
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2381', '450', '500', '0', 'buyBillController.php', '1711', '', '0', '0'); -- id=1260
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2381 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1711 ;
UPDATE product SET productName = 'موديل 470 الشايب', productDescription = '', productCatId = '207', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02381',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2381';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1711;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2381;
UPDATE storedetail SET  productquantity = '500', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '500', '0', '310', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '500', '5', '2026-10-22 08:24:10','0','0'); -- id=16299
UPDATE supplier SET  suppliercurrentDebt = '440000',suppliercurrentDebtInCurrency= '436850' , userid = '5', supplierdate = '2026-10-22 08:24:46'   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', '440000', '0', 'اضافة فاتورة مشتريات', '310', '440000', '2026-10-22 08:24:10', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','440000','1','-3150','440000','436850','0',''); -- id=852
update buybill set dailyentryid='0,0' where buybillid=310;
COMMIT;
UPDATE product SET overAllAveragePrice = 430 WHERE productId = 2380;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2381;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:54:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:24:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:24:46', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=310'); -- id=17215
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:54:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:24:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:24:49', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=310&type=2'); -- id=17216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:58:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:28:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:28:38', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=310&type=2'); -- id=17217
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:58:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:28:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:28:39', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=310'); -- id=17218
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:58:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:28:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:28:40', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17219
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:58:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:28:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:28:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:58:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:28:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:28:59', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17221
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:59:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:29:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:29:10', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:59:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:29:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:29:18', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17223
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 04:59:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:29:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:29:37', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17224
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:01:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:31:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:31:04', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17225
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 480 سفنتي ','','88','440','480','0','0','2026-10-22','0','5','0','','0','0','0','0','0','440','440','440','440','440','0','9.09','0','0','.','0','0','0','440','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','440','440','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','440','0','0','0','0','0','0','','','0','0','0','0'); -- id=2382
UPDATE product SET productName = 'موديل 480 سفنتي ', productDescription = '', productCatId = '88', productBuyPrice = '440', productSellAllPrice = '480', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02382',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '9.09' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2382';
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', '2382', '1.00', '2026-10-22', '5', '0','0238201','480','0','0','440','','0','0','0','0','0','0','0','0','0','0'); -- id=2382
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2382', '1', '0', '5', '2026-10-22'); -- id=3776
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2382', '1', '0', '0', '2382', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16300
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2382, 1,'2026-10-22 08:31:04',5)
                ON DUPLICATE KEY UPDATE productid = 2382, edited = 1, sysdate = '2026-10-22 08:31:04', userid = 5; -- id=3557
UPDATE product SET productName = 'موديل 480 سفنتي ', productDescription = '', productCatId = '88', productBuyPrice = '440.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02382',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '9.09' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2382';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:01:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:31:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:31:06', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17226
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:01:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:31:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:31:10', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17227
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:02:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:32:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:32:06', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17228
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 ('06ad99f9e64d51', '2026-10-22 08:31:10', '1', '436850.00', '457970', '0', '0', '21120.00',  '21120.00', '', '21120', '1', '2026-10-22 08:32:06', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=311
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 ('02382', '311', '88', '2382', '48', '440', '21120.00', '0', '', '2026-10-22 08:32:06', '2382','','','0','0','0','0','0',null,'440','21120','0','0','0','0','0','0','0','0','1'); -- id=1712
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:31:10', 1, 2382, 0, 0
                    , 440, 48, 0, 0, 5, '2026-10-22 08:32:06')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:32:06' ; -- id=7033
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2382', '440', '48', '0', 'buyBillController.php', '1712', '', '0', '0'); -- id=1261
UPDATE product SET  productBuyPrice = "440" WHERE productId = 2382 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1712 ;
UPDATE product SET productName = 'موديل 480 سفنتي ', productDescription = '', productCatId = '88', productBuyPrice = '440.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02382',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2382';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1712;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2382;
UPDATE storedetail SET  productquantity = '48', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2382', '1', '48', '0', '311', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '5', '2026-10-22 08:31:10','0','0'); -- id=16301
UPDATE supplier SET  suppliercurrentDebt = '461120',suppliercurrentDebtInCurrency= '457970' , userid = '5', supplierdate = '2026-10-22 08:32: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', '440000.00', '21120', '0', 'اضافة فاتورة مشتريات', '311', '461120', '2026-10-22 08:31:10', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','21120','1','436850','21120','457970','0',''); -- id=853
update buybill set dailyentryid='0,0' where buybillid=311;
COMMIT;
UPDATE product SET overAllAveragePrice = 440 WHERE productId = 2382;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:02:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:32:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:32:06', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=311'); -- id=17229
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:02:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:32:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:32:10', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=311&type=2'); -- id=17230
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:03:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:33:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:33:05', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=311&type=2'); -- id=17231
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:03:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:33:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:33:19', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17232
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:03:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:33:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:33:30', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17233
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:04:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:34:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:34:59', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17234
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:05:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:35:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:35:01', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17235
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:06:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:36:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:36:02', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17236
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 470 فرنكو ','','95','470','470','0','0','2026-10-22','0','5','0','','0','0','0','0','0','470','470','470','470','470','0','0','0','0','.','0','0','0','470','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','470','470','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','470','0','0','0','0','0','0','','','0','0','0','0'); -- id=2383
UPDATE product SET productName = 'موديل 470 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '470', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02383',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2383';
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', '2383', '1.00', '2026-10-22', '5', '0','0238301','470','0','0','470','','0','0','0','0','0','0','0','0','0','0'); -- id=2383
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2383', '1', '0', '5', '2026-10-22'); -- id=3777
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2383', '1', '0', '0', '2383', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16302
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2383, 1,'2026-10-22 08:36:02',5)
                ON DUPLICATE KEY UPDATE productid = 2383, edited = 1, sysdate = '2026-10-22 08:36:02', userid = 5; -- id=3558
UPDATE product SET productName = 'موديل 470 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02383',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2383';
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 ('موديل 530 فرنكو ','','95','530','530','0','0','2026-10-22','0','5','0','','0','0','0','0','0','530','530','530','530','530','0','0','0','0','.','0','0','0','530','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','530','530','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','530','0','0','0','0','0','0','','','0','0','0','0'); -- id=2384
UPDATE product SET productName = 'موديل 530 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '530', productSellAllPrice = '530', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02384',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2384';
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', '2384', '1.00', '2026-10-22', '5', '0','0238401','530','0','0','530','','0','0','0','0','0','0','0','0','0','0'); -- id=2384
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2384', '1', '0', '5', '2026-10-22'); -- id=3778
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2384', '1', '0', '0', '2384', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16303
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2384, 1,'2026-10-22 08:36:02',5)
                ON DUPLICATE KEY UPDATE productid = 2384, edited = 1, sysdate = '2026-10-22 08:36:02', userid = 5; -- id=3559
UPDATE product SET productName = 'موديل 530 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02384',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2384';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:06:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:36:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:36:03', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17237
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:06:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:36:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:36:05', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17238
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:08:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:38:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:38:41', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17239
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 ('06ad9a0c511394', '2026-10-22 08:36:05', '79', '-627392.00', '-561836', '10', '1', '72840.00',  '65556.00', '0', '65556', '1', '2026-10-22 08:38:41', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=312
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 ('01385', '312', '95', '1385', '48', '450', '21600.00', '0', '', '2026-10-22 08:38:41', '1385','','','0','0','0','0','0',null,'450','21600','0','0','0','0','0','0','0','0','1'); -- id=1713
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:36:05', 1, 1385, 0, 0
                    , 405, 48, 0, 0, 5, '2026-10-22 08:38:41')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:38:41' ; -- id=7034
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1385', '450', '48', '0', 'buyBillController.php', '1713', '', '0', '0'); -- id=1262
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1385 ;
UPDATE buybilldetail SET  quantitybefore = 186 WHERE buybilldetailid = 1713 ;
UPDATE product SET productName = 'فرنكو 450', productDescription = '', productCatId = '95', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01385',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '420.98' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='290.16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1385';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 420.98
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 290.16, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1713;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1385;
UPDATE storedetail SET  productquantity = '234', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '1385';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1385', '1', '48', '0', '312', 'اضافة فاتورة مشتريات', 'buyBillController.php', '186', '234', '5', '2026-10-22 08:36:05','0','0'); -- id=16304
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 ('02383', '312', '95', '2383', '51', '470', '23970.00', '0', '', '2026-10-22 08:38:41', '2383','','','0','0','0','0','0',null,'470','23970','0','0','0','0','0','0','0','0','1'); -- id=1714
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:36:05', 1, 2383, 0, 0
                    , 423, 51, 0, 0, 5, '2026-10-22 08:38:41')
                ON DUPLICATE KEY UPDATE buyprice = 423,
                        buyQuantity =buyQuantity+51, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:38:41' ; -- id=7035
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2383', '470', '51', '0', 'buyBillController.php', '1714', '', '0', '0'); -- id=1263
UPDATE product SET  productBuyPrice = "470" WHERE productId = 2383 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1714 ;
UPDATE product SET productName = 'موديل 470 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02383',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '423',meanbuyprice = '470',meanbuyprice_withDiscount = '423' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='423',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2383';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 423, meanbuyprice_withDiscount = 423
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 423
                where buybilldetailid = 1714;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 2383;
UPDATE storedetail SET  productquantity = '51', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2383', '1', '51', '0', '312', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '51', '5', '2026-10-22 08:36:05','0','0'); -- id=16305
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 ('02384', '312', '95', '2384', '27', '530', '14310.00', '0', '', '2026-10-22 08:38:41', '2384','','','0','0','0','0','0',null,'530','14310','0','0','0','0','0','0','0','0','1'); -- id=1715
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:36:05', 1, 2384, 0, 0
                    , 477, 27, 0, 0, 5, '2026-10-22 08:38:41')
                ON DUPLICATE KEY UPDATE buyprice = 477,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:38:41' ; -- id=7036
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2384', '530', '27', '0', 'buyBillController.php', '1715', '', '0', '0'); -- id=1264
UPDATE product SET  productBuyPrice = "530" WHERE productId = 2384 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1715 ;
UPDATE product SET productName = 'موديل 530 فرنكو ', productDescription = '', productCatId = '95', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02384',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '477',meanbuyprice = '530',meanbuyprice_withDiscount = '477' , productbuypricereal = '530.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='477',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2384';
UPDATE buybilldetail SET  lastbuyprice = 530 , meanbuyprice = 530, lastbuyprice_withDiscount = 477, meanbuyprice_withDiscount = 477
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 477
                where buybilldetailid = 1715;
UPDATE productunit SET proUnitBuyPrice  = 530 * productnumber WHERE productid = 2384;
UPDATE storedetail SET  productquantity = '27', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3778';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2384', '1', '27', '0', '312', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '5', '2026-10-22 08:36:05','0','0'); -- id=16306
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 ('02140', '312', '95', '2140', '27', '480', '12960.00', '0', '', '2026-10-22 08:38:41', '2140','','','0','0','0','0','0',null,'480','12960','0','0','0','0','0','0','0','0','1'); -- id=1716
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:36:05', 1, 2140, 0, 0
                    , 432, 27, 0, 0, 5, '2026-10-22 08:38:41')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:38:41' ; -- id=7037
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2140', '480', '27', '0', 'buyBillController.php', '1716', '', '0', '0'); -- id=1265
UPDATE product SET  productBuyPrice = "480" WHERE productId = 2140 ;
UPDATE buybilldetail SET  quantitybefore = 21 WHERE buybilldetailid = 1716 ;
UPDATE product SET productName = 'فرنكو 480', productDescription = '', productCatId = '95', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02140',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '442.5' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='432',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='375',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2140';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 442.5
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 1716;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 2140;
UPDATE storedetail SET  productquantity = '48', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3499';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2140', '1', '27', '0', '312', 'اضافة فاتورة مشتريات', 'buyBillController.php', '21', '48', '5', '2026-10-22 08:36:05','0','0'); -- id=16307
UPDATE supplier SET  suppliercurrentDebt = '-561836',suppliercurrentDebtInCurrency= '-561836' , userid = '5', supplierdate = '2026-10-22 08:38:41'   WHERE supplierid = '79';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('79', '-627392.00', '65556', '0', 'اضافة فاتورة مشتريات', '312', '-561836', '2026-10-22 08:36:05', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','65556','1','-627392','65556','-561836','0',''); -- id=854
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '65556', '65556', '2026-10-22', '5', '0', '0', '2026-10-22 08:38:41','اضافة فاتورة مشتريات رقم 312','1','0',null,'0','312','buyBillController.php?do=details&id=312'); -- id=4286
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4286', '382', '65556', '','0'); -- id=4400
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25741263.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4286', '505', '65556', '','0'); -- id=4288
UPDATE accountstree SET name = 'فرنكو', customName = 'فرنكو', customNameEn = 'فرنكو', nameEn = 'فرنكو', parent = '81', accountNature = '1', theValue = '-561836', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 20:20:28' WHERE id = '505';
update buybill set dailyentryid='4286,0' where buybillid=312;
COMMIT;
UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1385;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 2140;UPDATE product SET overAllAveragePrice = 423 WHERE productId = 2383;UPDATE product SET overAllAveragePrice = 477 WHERE productId = 2384;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:08:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:38:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:38:42', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=312'); -- id=17240
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:08:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:38:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:38:44', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=312&type=2'); -- id=17241
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:09:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:39:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:39:24', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=312&type=2'); -- id=17242
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:11:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:41:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 08:41:26', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17243
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:11:27";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 08:41:27', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17244
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:11:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:41:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:41:31', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17245
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:14:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:44:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:44:28', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=312&type=2'); -- id=17246
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:14:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:44:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:44:30', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=312'); -- id=17247
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:14:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:44:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:44:32', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17248
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:14:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:44:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:44:45', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17249
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:14:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:44:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:44:54', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=311'); -- id=17250
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:15:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:45:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:45:04', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17251
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:15:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:45:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:45:46', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17252
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:16:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:46:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:46:58', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17253
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:17:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:47:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:47:08', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17254
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:17:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:47:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:47:35', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=311'); -- id=17255
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:17:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:47:40", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:47:40', '2', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1208'); -- id=17256
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:18:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:48:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:48:35', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17257
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:18:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:48:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:48:49', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17258
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:18:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:48:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBillreportController.php', '2026-10-22 08:48:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBillreportController.php'); -- id=17259
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:49:04', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17260
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:09", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:49:09', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=6'); -- id=17261
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:49:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17262
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:49:25', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=1'); -- id=17263
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:49:31', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17264
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreportbills.php', '2026-10-22 08:49:40', '5', 'reviewbills', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/salesreportbills.php?do=reviewbills'); -- id=17265
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:19:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:49:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:49:55', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17266
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 08:50:00', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17267
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:50:05', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17268
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:50:17', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17269
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:50:18', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17270
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:50:25', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=311'); -- id=17271
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:20:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:50:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:50:55', '5', 'showoffers', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showoffers'); -- id=17272
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:51:10', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17273
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:51:10', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17274
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 08:51:28', '5', 'invReport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=invReport'); -- id=17275
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBillreportController.php', '2026-10-22 08:51:45', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBillreportController.php'); -- id=17276
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 08:51:50', '5', 'invReport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=invReport'); -- id=17277
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:51:52', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17278
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:51:55', '5', 'showoffers', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showoffers'); -- id=17279
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:21:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:51:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:51:57', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=311'); -- id=17280
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:22:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:52:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 08:52:00', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17281
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:22:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:52:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:52:15', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17282
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:22:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:52:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:52:32', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17283
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:22:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:52:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:52:38', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=311'); -- id=17284
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:23:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:53:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:53:07', '5', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=17285
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 311;
UPDATE buybill SET  buybillsysdate = '2026-10-22 08:53:07', userid = '5',delbyuserid = '5', conditions = '1' WHERE buybillid = '311';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:31:10', 1, 2382, 0, 0
                    , 440, 48, 0, 0, 5, '2026-10-22 08:53:07')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-48, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:53:07' ; -- id=7033
UPDATE buybilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440.00, meanbuyprice_withTax = 440.00, lastbuyprice_withDiscountAndTax = 440.00
                where buybilldetailid = 1712;
UPDATE product SET productName = 'موديل 480 سفنتي ', productDescription = '', productCatId = '88', productBuyPrice = '440.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02382',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '0',meanbuyprice = '440.00',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2382';
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2382;
UPDATE storedetail SET  productquantity = '0', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2382', '1', '48', '1', '311', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '48', '0', '5', '2026-10-22 08:31:10','0','0'); -- id=16308
UPDATE supplier SET  suppliercurrentDebt = '440000',suppliercurrentDebtInCurrency= '436850' , userid = '5', supplierdate = '2026-10-22 08:53:07'   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', '461120.00', '21120.00', '1', 'حذف فاتورة مشتريات - للتعديل', '311', '440000', '2026-10-22 08:31:10', '5', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','21120','1','457970','21120','436850','0',''); -- id=855
UPDATE productserial SET del = 1
		 WHERE billid = 311;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ad99f9e64d51', '2026-10-22 08:31:10', '75', '-66310.00', '-45190', '0', '0', '21120.00', '21120.00', '0.00', '21120', '1', '2026-10-22 08:53:07', '', '5', '0', '', '1', '1','1','311','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=313
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 ('02382', '313', '88', '2382', '48.00', '440', '21120.00', '0.00', '', '2026-10-22 08:53:07', '2382','','','0','0','0','0','0',null,'440','21120','0','0','0','0','0','0','0','0','1'); -- id=1717
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:31:10', 1, 2382, 0, 0
                    , 440, 48, 0, 0, 5, '2026-10-22 08:53:07')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 08:53:07' ; -- id=7033
UPDATE product SET  productBuyPrice = "440" WHERE productId = 2382 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1717 ;
UPDATE product SET productName = 'موديل 480 سفنتي ', productDescription = '', productCatId = '88', productBuyPrice = '440.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02382',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='220',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2382';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 220, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1717;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2382;
UPDATE storedetail SET  productquantity = '48', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3776';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2382', '1', '48', '0', '313', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '5', '2026-10-22 08:31:10','0','0'); -- id=16309
DELETE FROM productserial WHERE billid = 311
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '-45190',suppliercurrentDebtInCurrency= '-45190' , userid = '5', supplierdate = '2026-10-22 08:53:07'   WHERE supplierid = '75';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('75', '-66310.00', '21120', '0', 'اضافة فاتورة مشتريات', '313', '-45190', '2026-10-22 08:53:07', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','21120','1','-66310','21120','-45190','0',''); -- id=856
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21120', '21120', '2026-10-22', '5', '0', '0', '2026-10-22 08:53:07','اضافة فاتورة مشتريات رقم 313','1','0',null,'0','313','buyBillController.php?do=details&id=313'); -- id=4287
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4287', '382', '21120', '','0'); -- id=4401
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25762383.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4287', '499', '21120', '','0'); -- id=4289
UPDATE accountstree SET name = 'سفنتي', customName = 'سفنتي', customNameEn = 'سفنتي', nameEn = 'سفنتي', parent = '81', accountNature = '1', theValue = '-45190', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 16:43:09' WHERE id = '499';
update buybill set dailyentryid='4287,0' where buybillid=313;
UPDATE product SET overAllAveragePrice = 440 WHERE productId = 2382;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:23:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:53:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:53:07', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=313'); -- id=17286
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:23:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:53:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:53:50', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=311'); -- id=17287
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:23:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:53:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 08:53:51', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17288
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:14";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:54:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 08:54:26', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17289
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:26";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 08:54:26', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17290
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:40";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:54:43", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 08:54:43', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17291
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:54:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:54:44', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17292
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:44";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 08:54:44", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 08:54:44', '6', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17293
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:54:48", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:54:48', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17294
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:24:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:54:55", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 08:54:55', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17295
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:25:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:55:00", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:55:00', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17296
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:25:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:55:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:55:58', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17297
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:25:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:55:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 08:55:59', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17298
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:25:59";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 08:55:59', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17299
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:27:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:57:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:57:06', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17300
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:58:03', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17301
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:58:49', '5', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=17302
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('بابا المجال ','2026-10-22','','93', '5','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=208
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (208, 1,'2026-10-22 08:58:49',5)
                ON DUPLICATE KEY UPDATE catid = 208, edited = 1, sysdate = '2026-10-22 08:58:49', userid = 5; -- id=223
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:58:49', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=17303
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 08:58:51', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=17304
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:58:52', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17305
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:28:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:58:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 08:58:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17306
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:29:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:59:34", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:59:34', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17307

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9a53461ff4
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9a53461ff4 and sellbillId = 1209 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:29:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 08:59:34", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 08:59:34', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17308
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:31:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:01:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:01:25', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17309
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 460 بابا المجال ','','208','460','460','0','0','2026-10-22','0','5','0','','0','0','0','0','0','460','460','460','460','460','0','0','0','0','.','0','0','0','460','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','460','460','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','460','0','0','0','0','0','0','','','0','0','0','0'); -- id=2385
UPDATE product SET productName = 'موديل 460 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '460', productSellAllPrice = '460', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02385',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2385';
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', '2385', '1', '2026-10-22', '5', '0','0238501','460','0','0','460','','0','0','0','0','0','0','0','0','0','0'); -- id=2385
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2385', '1', '0', '5', '2026-10-22'); -- id=3779
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2385', '1', '0', '0', '2385', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16311
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2385, 1,'2026-10-22 09:01:25',5)
                ON DUPLICATE KEY UPDATE productid = 2385, edited = 1, sysdate = '2026-10-22 09:01:25', userid = 5; -- id=3560
UPDATE product SET productName = 'موديل 460 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02385',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2385';
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 ('موديل 500 بابا المجال','','208','500','500','0','0','2026-10-22','0','5','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=2386
UPDATE product SET productName = 'موديل 500 بابا المجال', productDescription = '', productCatId = '208', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02386',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2386';
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', '2386', '1', '2026-10-22', '5', '0','0238601','500','0','0','500','','0','0','0','0','0','0','0','0','0','0'); -- id=2386
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2386', '1', '0', '5', '2026-10-22'); -- id=3780
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2386', '1', '0', '0', '2386', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16312
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2386, 1,'2026-10-22 09:01:25',5)
                ON DUPLICATE KEY UPDATE productid = 2386, edited = 1, sysdate = '2026-10-22 09:01:25', userid = 5; -- id=3561
UPDATE product SET productName = 'موديل 500 بابا المجال', productDescription = '', productCatId = '208', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02386',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2386';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 450 بابا المجال ','','208','450','450','0','0','2026-10-22','0','5','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2387
UPDATE product SET productName = 'موديل 450 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02387',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2387';
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', '2387', '1', '2026-10-22', '5', '0','0238701','450','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2387
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2387', '1', '0', '5', '2026-10-22'); -- id=3781
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2387', '1', '0', '0', '2387', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16313
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2387, 1,'2026-10-22 09:01:25',5)
                ON DUPLICATE KEY UPDATE productid = 2387, edited = 1, sysdate = '2026-10-22 09:01:25', userid = 5; -- id=3562
UPDATE product SET productName = 'موديل 450 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02387',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2387';
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 ('موديل 870 بابا المجال ','','208','870','870','0','0','2026-10-22','0','5','0','','0','0','0','0','0','870','870','870','870','870','0','0','0','0','.','0','0','0','870','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','870','870','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','870','0','0','0','0','0','0','','','0','0','0','0'); -- id=2388
UPDATE product SET productName = 'موديل 870 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '870', productSellAllPrice = '870', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02388',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '870',lastbuyprice_withDiscount = '870',meanbuyprice = '870',meanbuyprice_withDiscount = '870' , productbuypricereal = '870' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='870',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='870',meanbuyprice_withTax='870',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='870',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2388';
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', '2388', '1', '2026-10-22', '5', '0','0238801','870','0','0','870','','0','0','0','0','0','0','0','0','0','0'); -- id=2388
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2388', '1', '0', '5', '2026-10-22'); -- id=3782
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2388', '1', '0', '0', '2388', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16314
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2388, 1,'2026-10-22 09:01:25',5)
                ON DUPLICATE KEY UPDATE productid = 2388, edited = 1, sysdate = '2026-10-22 09:01:25', userid = 5; -- id=3563
UPDATE product SET productName = 'موديل 870 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '870.00', productSellAllPrice = '870.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02388',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '870',lastbuyprice_withDiscount = '870',meanbuyprice = '870',meanbuyprice_withDiscount = '870' , productbuypricereal = '870' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='870',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='870',meanbuyprice_withTax='870',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='870',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2388';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:31:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:01:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:01:27', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17310
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('بابا المجال ', '', '', '', '', '0', '5', '2026-10-22 09:01:44', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=202
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 ('202', '0', '', '0', 'إضافة مورد جديد', '202', '', '2026-10-22 09:01:44', '5', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=857
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('بابا المجال ', 'بابا المجال ', 'بابا المجال ', 'بابا المجال ', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '5', '0', '2026-10-22 09:01:44'); -- id=689
UPDATE supplier SET suppliername = 'بابا المجال ', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '5', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='689',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '202';
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:31:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:01:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:01:49', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17311
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:31:49";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:01:49', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17312
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:02:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 09:02:22', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php'); -- id=17313
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:28";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:02:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:02:33', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17314
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:34";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 09:02:34", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:02:34', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17315
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:02:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 09:02:50', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=add'); -- id=17316
BEGIN;
CALL insertUniqueOptNum(25,1,2,2351,30,'2026-10-22',7,0, '' , '' ,0,0,0,0,0,'2026-10-22 09:02:50',0,'',0,'','hide',0,@id,@optnum);
UPDATE storedetail SET  productquantity = '0', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3745';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21', 1, 2351, 0, 0
                    , 725.00, 30, 0, 0, 7, '2026-10-22 09:02:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-30, sellQuantity = sellQuantity-0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:02:50' ; -- id=6984
UPDATE storemovement SET  buyPricesHistoryBookData = "30*2026-10-21*725.00," WHERE transferproductid = 1422;
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2351', '1', '30', '1', '1422', 'تحويل منتجات من المخزن', 'storemovementController.php', '30', '0', '7', '2026-10-22','0','0'); -- id=16315
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2351', '2', '30', '7', '2026-10-22'); -- id=3783
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-21', 2, 2351, 0, 0
                    , 725.00, 30, 0, 0, 7, '2026-10-22 09:02:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:02:50' ; -- id=7041
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2351', '2', '30', '0', '1422', 'تحويل منتجات إلى المخزن', 'storemovementController.php', '0', '30', '7', '2026-10-22','0','0'); -- id=16316
UPDATE storedetail SET inUse = 0 WHERE storedetailid=3745;
COMMIT;
BEGIN;
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21750', '21750', '2026-10-22', '7', '0', '0', '2026-10-22 09:02:50','تحويل من مخزن المخزن الرئيسي الى مخزن مخزن المحل','1','0',null,'0','25','storemovementController.php?do=show&operationnum=25'); -- id=4290
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4290', '492', '21750', '','0'); -- id=4404
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1572644', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4290', '382', '21750', '','0'); -- id=4292
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25736673.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
COMMIT;
UPDATE storemovement SET  dailyentryid =4290 WHERE operationnum = 25;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:02:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 09:02:50', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=sucess'); -- id=17317
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:32:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:02:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 09:02:52', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=show'); -- id=17318
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:33:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:03:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:03:38', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17319
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 ('06ad9a6b7522fc', '2026-10-22 09:01:27', '202', '0.00', '75600', '10', '1', '84000.00',  '75600.00', '0', '75600', '1', '2026-10-22 09:03:38', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=314
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 ('02385', '314', '208', '2385', '24', '460', '11040.00', '0', '', '2026-10-22 09:03:38', '2385','','','0','0','0','0','0',null,'460','11040','0','0','0','0','0','0','0','0','1'); -- id=1718
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:01:27', 1, 2385, 0, 0
                    , 414, 24, 0, 0, 5, '2026-10-22 09:03:38')
                ON DUPLICATE KEY UPDATE buyprice = 414,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:03:38' ; -- id=7042
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2385', '460', '24', '0', 'buyBillController.php', '1718', '', '0', '0'); -- id=1266
UPDATE product SET  productBuyPrice = "460" WHERE productId = 2385 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1718 ;
UPDATE product SET productName = 'موديل 460 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02385',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '414',meanbuyprice = '460',meanbuyprice_withDiscount = '414' , productbuypricereal = '460.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='414',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2385';
UPDATE buybilldetail SET  lastbuyprice = 460 , meanbuyprice = 460, lastbuyprice_withDiscount = 414, meanbuyprice_withDiscount = 414
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                where buybilldetailid = 1718;
UPDATE productunit SET proUnitBuyPrice  = 460 * productnumber WHERE productid = 2385;
UPDATE storedetail SET  productquantity = '24', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3779';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2385', '1', '24', '0', '314', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '5', '2026-10-22 09:01:27','0','0'); -- id=16317
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 ('02386', '314', '208', '2386', '93', '500', '46500.00', '0', '', '2026-10-22 09:03:38', '2386','','','0','0','0','0','0',null,'500','46500','0','0','0','0','0','0','0','0','1'); -- id=1719
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:01:27', 1, 2386, 0, 0
                    , 450, 93, 0, 0, 5, '2026-10-22 09:03:38')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+93, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:03:38' ; -- id=7043
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2386', '500', '93', '0', 'buyBillController.php', '1719', '', '0', '0'); -- id=1267
UPDATE product SET  productBuyPrice = "500" WHERE productId = 2386 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1719 ;
UPDATE product SET productName = 'موديل 500 بابا المجال', productDescription = '', productCatId = '208', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02386',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '450',meanbuyprice = '500',meanbuyprice_withDiscount = '450' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2386';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1719;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 2386;
UPDATE storedetail SET  productquantity = '93', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3780';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2386', '1', '93', '0', '314', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '93', '5', '2026-10-22 09:01:27','0','0'); -- id=16318
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 ('02387', '314', '208', '2387', '24', '450', '10800.00', '0', '', '2026-10-22 09:03:38', '2387','','','0','0','0','0','0',null,'450','10800','0','0','0','0','0','0','0','0','1'); -- id=1720
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:01:27', 1, 2387, 0, 0
                    , 405, 24, 0, 0, 5, '2026-10-22 09:03:38')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:03:38' ; -- id=7044
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2387', '450', '24', '0', 'buyBillController.php', '1720', '', '0', '0'); -- id=1268
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2387 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1720 ;
UPDATE product SET productName = 'موديل 450 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02387',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2387';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1720;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2387;
UPDATE storedetail SET  productquantity = '24', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3781';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2387', '1', '24', '0', '314', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '5', '2026-10-22 09:01:27','0','0'); -- id=16319
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 ('02388', '314', '208', '2388', '18', '870', '15660.00', '0', '', '2026-10-22 09:03:38', '2388','','','0','0','0','0','0',null,'870','15660','0','0','0','0','0','0','0','0','1'); -- id=1721
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:01:27', 1, 2388, 0, 0
                    , 783, 18, 0, 0, 5, '2026-10-22 09:03:38')
                ON DUPLICATE KEY UPDATE buyprice = 783,
                        buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:03:38' ; -- id=7045
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2388', '870', '18', '0', 'buyBillController.php', '1721', '', '0', '0'); -- id=1269
UPDATE product SET  productBuyPrice = "870" WHERE productId = 2388 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1721 ;
UPDATE product SET productName = 'موديل 870 بابا المجال ', productDescription = '', productCatId = '208', productBuyPrice = '870.00', productSellAllPrice = '870.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02388',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '870',lastbuyprice_withDiscount = '783',meanbuyprice = '870',meanbuyprice_withDiscount = '783' , productbuypricereal = '870.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='870',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='870',meanbuyprice_withTax='870',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='783',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2388';
UPDATE buybilldetail SET  lastbuyprice = 870 , meanbuyprice = 870, lastbuyprice_withDiscount = 783, meanbuyprice_withDiscount = 783
        , lastbuyprice_withTax = 870, meanbuyprice_withTax = 870, lastbuyprice_withDiscountAndTax = 783
                where buybilldetailid = 1721;
UPDATE productunit SET proUnitBuyPrice  = 870 * productnumber WHERE productid = 2388;
UPDATE storedetail SET  productquantity = '18', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3782';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2388', '1', '18', '0', '314', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '18', '5', '2026-10-22 09:01:27','0','0'); -- id=16320
UPDATE supplier SET  suppliercurrentDebt = '75600',suppliercurrentDebtInCurrency= '75600' , userid = '5', supplierdate = '2026-10-22 09:03:38'   WHERE supplierid = '202';
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 ('202', '0.00', '75600', '0', 'اضافة فاتورة مشتريات', '314', '75600', '2026-10-22 09:01:27', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','75600','1','0','75600','75600','0',''); -- id=858
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '75600', '75600', '2026-10-22', '5', '0', '0', '2026-10-22 09:03:38','اضافة فاتورة مشتريات رقم 314','1','0',null,'0','314','buyBillController.php?do=details&id=314'); -- id=4291
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4291', '382', '75600', '','0'); -- id=4405
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25812273.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4291', '689', '75600', '','0'); -- id=4293
UPDATE accountstree SET name = 'بابا المجال ', customName = 'بابا المجال ', customNameEn = 'بابا المجال ', nameEn = 'بابا المجال ', parent = '81', accountNature = '1', theValue = '75600', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '5', del = '0', sysdate = '2026-10-22 09:01:44' WHERE id = '689';
update buybill set dailyentryid='4291,0' where buybillid=314;
COMMIT;
UPDATE product SET overAllAveragePrice = 414 WHERE productId = 2385;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2386;UPDATE product SET overAllAveragePrice = 405 WHERE productId = 2387;UPDATE product SET overAllAveragePrice = 783 WHERE productId = 2388;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:33:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:03:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:03:38', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=314'); -- id=17320
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:33:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:03:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:03:43', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=314&type=2'); -- id=17321
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:33:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:03:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:03:49', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17322
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:34:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:04:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:04:33', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17323
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:34:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:04:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:04:54', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17324
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:35:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:05:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:05:26', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17325
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:35:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:05:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:05:32', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17326

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9a6466d380
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9a6466d380 and sellbillId = 1210 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:35:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:05:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:05:32', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17327
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:35:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:05:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:05:57', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=314&type=2'); -- id=17328
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:06:00', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=314'); -- id=17329
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:06:02', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17330
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:06:02', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17331
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreportbills.php', '2026-10-22 09:06:11', '5', 'billReservation', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/salesreportbills.php?do=billReservation'); -- id=17332
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:06:20', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17333
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديلات 520 تو بي','','149','520','520','0','0','2026-10-22','0','7','0','','0','0','0','0','0','520','520','520','520','520','0','0','0','0','.','0','0','0','520','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','520','520','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','520','0','0','0','0','0','0','','','0','0','0','0'); -- id=2389
UPDATE product SET productName = 'موديلات 520 تو بي', productDescription = '', productCatId = '149', productBuyPrice = '520', productSellAllPrice = '520', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02389',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2389';
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', '2389', '1', '2026-10-22', '7', '0','0238901','520','0','0','520','','0','0','0','0','0','0','0','0','0','0'); -- id=2389
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2389', '1', '0', '7', '2026-10-22'); -- id=3784
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2389', '1', '0', '0', '2389', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16323
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2389, 1,'2026-10-22 09:06:20',7)
                ON DUPLICATE KEY UPDATE productid = 2389, edited = 1, sysdate = '2026-10-22 09:06:20', userid = 7; -- id=3564
UPDATE product SET productName = 'موديلات 520 تو بي', productDescription = '', productCatId = '149', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02389',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2389';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:06:22', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17334
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('ReturnSellBillReportsController.php', '2026-10-22 09:06:24', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/ReturnSellBillReportsController.php?do=show'); -- id=17335
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:06:29', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17336
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:06:30', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17337
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userratereportController.php', '2026-10-22 09:06:31', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userratereportController.php'); -- id=17338
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userratereportController.php', '2026-10-22 09:06:31', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userratereportController.php?do=show'); -- id=17339
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('allReportsOnOne.php', '2026-10-22 09:06:42', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/allReportsOnOne.php'); -- id=17340
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('userratereportController.php', '2026-10-22 09:06:44', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/userratereportController.php?do=show'); -- id=17341
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:06:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('allReportsOnOne.php', '2026-10-22 09:06:46', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/allReportsOnOne.php'); -- id=17342
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:36:55";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:07:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:07:10', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17343
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:11";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:07:11', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17344
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:29";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:29";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:07:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:07:42', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17345
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:43";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:07:43', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17346
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:07:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:07:44', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17347
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:37:44";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:07:44', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17348
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:08:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:08:18', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17349
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:18";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:08:18', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17350
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:08:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 09:08:26', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php'); -- id=17351
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:08:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:08:37', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17352
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:37";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 09:08:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:08:37', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17353
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:38:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:08:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:08:39', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17354
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:39:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:09:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:09:13', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17355
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 ('06ad9a7e63df82', '2026-10-22 09:06:30', '166', '64755.20', '116974.4', '8', '1', '56760.00',  '52219.20', '0', '52219.2', '1', '2026-10-22 09:09:13', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=315
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 ('02389', '315', '149', '2389', '27', '520', '14040.00', '0', '', '2026-10-22 09:09:13', '2389','','','0','0','0','0','0',null,'520','14040','0','0','0','0','0','0','0','0','1'); -- id=1722
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:06:30', 1, 2389, 0, 0
                    , 478.4, 27, 0, 0, 7, '2026-10-22 09:09:13')
                ON DUPLICATE KEY UPDATE buyprice = 478.4,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:09:13' ; -- id=7046
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2389', '520', '27', '0', 'buyBillController.php', '1722', '', '0', '0'); -- id=1270
UPDATE product SET  productBuyPrice = "520" WHERE productId = 2389 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1722 ;
UPDATE product SET productName = 'موديلات 520 تو بي', productDescription = '', productCatId = '149', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02389',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '478.4',meanbuyprice = '520',meanbuyprice_withDiscount = '478.4' , productbuypricereal = '520.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='478.4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2389';
UPDATE buybilldetail SET  lastbuyprice = 520 , meanbuyprice = 520, lastbuyprice_withDiscount = 478.4, meanbuyprice_withDiscount = 478.4
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 478.4
                where buybilldetailid = 1722;
UPDATE productunit SET proUnitBuyPrice  = 520 * productnumber WHERE productid = 2389;
UPDATE storedetail SET  productquantity = '27', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3784';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2389', '1', '27', '0', '315', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '7', '2026-10-22 09:06:30','0','0'); -- id=16324
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 ('02389', '315', '149', '2389', '33', '520', '17160.00', '0', '', '2026-10-22 09:09:13', '2389','','','0','0','0','0','0',null,'520','17160','0','0','0','0','0','0','0','0','1'); -- id=1723
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:06:30', 1, 2389, 0, 0
                    , 478.4, 33, 0, 0, 7, '2026-10-22 09:09:13')
                ON DUPLICATE KEY UPDATE buyprice = 478.4,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:09:13' ; -- id=7046
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2389', '520', '33', '0', 'buyBillController.php', '1723', '', '0', '0'); -- id=1271
UPDATE product SET  productBuyPrice = "520" WHERE productId = 2389 ;
UPDATE buybilldetail SET  quantitybefore = 27 WHERE buybilldetailid = 1723 ;
UPDATE product SET productName = 'موديلات 520 تو بي', productDescription = '', productCatId = '149', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02389',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '478.4',meanbuyprice = '520',meanbuyprice_withDiscount = '478.4' , productbuypricereal = '520.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='478.4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2389';
UPDATE buybilldetail SET  lastbuyprice = 520 , meanbuyprice = 520, lastbuyprice_withDiscount = 478.4, meanbuyprice_withDiscount = 478.4
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 478.4
                where buybilldetailid = 1723;
UPDATE productunit SET proUnitBuyPrice  = 520 * productnumber WHERE productid = 2389;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3784';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2389', '1', '33', '0', '315', 'اضافة فاتورة مشتريات', 'buyBillController.php', '27', '60', '7', '2026-10-22 09:06:30','0','0'); -- id=16325
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 ('01898', '315', '149', '1898', '27', '480', '12960.00', '0', '', '2026-10-22 09:09:13', '1898','','','0','0','0','0','0',null,'480','12960','0','0','0','0','0','0','0','0','1'); -- id=1724
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:06:30', 1, 1898, 0, 0
                    , 441.6, 27, 0, 0, 7, '2026-10-22 09:09:13')
                ON DUPLICATE KEY UPDATE buyprice = 441.6,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:09:13' ; -- id=7048
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1898', '480', '27', '0', 'buyBillController.php', '1724', '', '0', '0'); -- id=1272
UPDATE product SET  productBuyPrice = "480" WHERE productId = 1898 ;
UPDATE buybilldetail SET  quantitybefore = 6 WHERE buybilldetailid = 1724 ;
UPDATE product SET productName = 'بوكس تطريز جلد تو بي', productDescription = '', productCatId = '149', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '480.00', productSellHalfPrice = '480.00', productDate = '2026-10-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01898',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '441.6',meanbuyprice = '480',meanbuyprice_withDiscount = '445.09' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='441.6',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='436.36',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='441.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1898';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 441.6, meanbuyprice_withDiscount = 445.09
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 436.36, lastbuyprice_withDiscountAndTax = 441.6
                where buybilldetailid = 1724;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 1898;
UPDATE storedetail SET  productquantity = '33', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1898', '1', '27', '0', '315', 'اضافة فاتورة مشتريات', 'buyBillController.php', '6', '33', '7', '2026-10-22 09:06:30','0','0'); -- id=16326
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 ('01904', '315', '149', '1904', '36', '350', '12600.00', '0', '', '2026-10-22 09:09:13', '1904','','','0','0','0','0','0',null,'350','12600','0','0','0','0','0','0','0','0','1'); -- id=1725
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:06:30', 1, 1904, 0, 0
                    , 322, 36, 0, 0, 7, '2026-10-22 09:09:13')
                ON DUPLICATE KEY UPDATE buyprice = 322,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:09:13' ; -- id=7049
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1904', '350', '36', '0', 'buyBillController.php', '1725', '', '0', '0'); -- id=1273
UPDATE product SET  productBuyPrice = "350" WHERE productId = 1904 ;
UPDATE buybilldetail SET  quantitybefore = 6 WHERE buybilldetailid = 1725 ;
UPDATE product SET productName = 'نصف ياقه سوسته تو بي ', productDescription = '', productCatId = '149', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01904',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '322',meanbuyprice = '350',meanbuyprice_withDiscount = '324' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='322',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='325',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='322',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1904';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 322, meanbuyprice_withDiscount = 324
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 322
                where buybilldetailid = 1725;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 1904;
UPDATE storedetail SET  productquantity = '42', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2921';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1904', '1', '36', '0', '315', 'اضافة فاتورة مشتريات', 'buyBillController.php', '6', '42', '7', '2026-10-22 09:06:30','0','0'); -- id=16327
UPDATE supplier SET  suppliercurrentDebt = '116974.4',suppliercurrentDebtInCurrency= '116974.4' , userid = '7', supplierdate = '2026-10-22 09:09:13'   WHERE supplierid = '166';
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 ('166', '64755.20', '52219.2', '0', 'اضافة فاتورة مشتريات', '315', '116974.4', '2026-10-22 09:06:30', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','52219.2','1','64755.2','52219.2','116974.4','0',''); -- id=859
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '52219.2', '52219.2', '2026-10-22', '7', '0', '0', '2026-10-22 09:09:13','اضافة فاتورة مشتريات رقم 315','1','0',null,'0','315','buyBillController.php?do=details&id=315'); -- id=4294
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4294', '382', '52219.2', '','0'); -- id=4408
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25856512.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4294', '649', '52219.2', '','0'); -- id=4296
UPDATE accountstree SET name = 'تو بي', customName = 'تو بي', customNameEn = 'تو بي', nameEn = 'تو بي', parent = '81', accountNature = '1', theValue = '116974.4', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-13 11:47:55' WHERE id = '649';
update buybill set dailyentryid='4294,0' where buybillid=315;
COMMIT;
UPDATE product SET overAllAveragePrice = 441.6 WHERE productId = 1898;UPDATE product SET overAllAveragePrice = 322 WHERE productId = 1904;UPDATE product SET overAllAveragePrice = 478.4 WHERE productId = 2389;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:39:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:09:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:09:13', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=315'); -- id=17356
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:39:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:09:21", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:09:21', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=315&type=2'); -- id=17357
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:40:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:10:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:10:37', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17358

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9a40347b5b
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9a40347b5b and sellbillId = 1211 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:40:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:10:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:10:37', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17359
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:41:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:11:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:11:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17360
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:41:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:11:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:11:52', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17361
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:42:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:12:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:12:19', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=315&type=2'); -- id=17362
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:04";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:13:05', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17363
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:13:24', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17364
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:13:30', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17365
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:13:43', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17366
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:13:50', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=310'); -- id=17367
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:43:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:13:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:13:58', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17368
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:44:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:14:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:14:41', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17369
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:44:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:14:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:14:46', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17370
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:44:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:14:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:14:58', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17371
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:45:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:15:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:15:37', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17372
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:45:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:15:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:15:37', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17373
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:16:27', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=17374
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('اوك حمزاوي','2026-10-22','','93', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=209
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (209, 1,'2026-10-22 09:16:27',7)
                ON DUPLICATE KEY UPDATE catid = 209, edited = 1, sysdate = '2026-10-22 09:16:27', userid = 7; -- id=224
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '209', '1', '2026-10-22', '7', '0'); -- id=99
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:16:27', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=17375
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:16:29', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=17376
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:16:31', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17377
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:16:32', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17378
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:16:37', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17379
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:46:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:16:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:16:59', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17380
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:47:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:17:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:17:15', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17381
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:47:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:17:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:17:35', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17382
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:48:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:18:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:18:05', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17383
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل حروف اوك حمزاوي','','209','350','350','0','0','2026-10-22','0','7','0','','0','0','0','0','0','350','350','350','350','350','0','0','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=2390
UPDATE product SET productName = 'موديل حروف اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '350', productSellAllPrice = '350', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02390',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2390';
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', '2390', '1.00', '2026-10-22', '7', '0','0239001','350','0','0','350','','0','0','0','0','0','0','0','0','0','0'); -- id=2390
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2390', '1', '0', '7', '2026-10-22'); -- id=3785
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '0', '0', '2390', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16330
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2390, 1,'2026-10-22 09:18:05',7)
                ON DUPLICATE KEY UPDATE productid = 2390, edited = 1, sysdate = '2026-10-22 09:18:05', userid = 7; -- id=3565
UPDATE product SET productName = 'موديل حروف اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02390',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2390';
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 ('سوستة سادة اوك حمزاوي','','209','440','440','0','0','2026-10-22','0','7','0','','0','0','0','0','0','440','440','440','440','440','0','0','0','0','.','0','0','0','440','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','440','440','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','440','0','0','0','0','0','0','','','0','0','0','0'); -- id=2391
UPDATE product SET productName = 'سوستة سادة اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '440', productSellAllPrice = '440', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02391',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2391';
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', '2391', '1.00', '2026-10-22', '7', '0','0239101','440','0','0','440','','0','0','0','0','0','0','0','0','0','0'); -- id=2391
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2391', '1', '0', '7', '2026-10-22'); -- id=3786
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2391', '1', '0', '0', '2391', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16331
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2391, 1,'2026-10-22 09:18:05',7)
                ON DUPLICATE KEY UPDATE productid = 2391, edited = 1, sysdate = '2026-10-22 09:18:05', userid = 7; -- id=3566
UPDATE product SET productName = 'سوستة سادة اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '440.00', productSellAllPrice = '440.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02391',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2391';
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 ('سوستة تطريز اوك حمزاوي','','209','480','480','0','0','2026-10-22','0','7','0','','0','0','0','0','0','480','480','480','480','480','0','0','0','0','.','0','0','0','480','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','480','480','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','480','0','0','0','0','0','0','','','0','0','0','0'); -- id=2392
UPDATE product SET productName = 'سوستة تطريز اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '480', productSellAllPrice = '480', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02392',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2392';
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', '2392', '1.00', '2026-10-22', '7', '0','0239201','480','0','0','480','','0','0','0','0','0','0','0','0','0','0'); -- id=2392
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2392', '1', '0', '7', '2026-10-22'); -- id=3787
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2392', '1', '0', '0', '2392', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16332
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2392, 1,'2026-10-22 09:18:05',7)
                ON DUPLICATE KEY UPDATE productid = 2392, edited = 1, sysdate = '2026-10-22 09:18:05', userid = 7; -- id=3567
UPDATE product SET productName = 'سوستة تطريز اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02392',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2392';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:48:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:18:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:18:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17384
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:48:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:18:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:18:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17385
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:48:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:18:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:18:13', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17386
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:48:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:18:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:18:15', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17387
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('اوك حمزاوي', '', '', '', '', '0', '7', '2026-10-22 09:18:19', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=203
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 ('203', '0', '', '0', 'إضافة مورد جديد', '203', '', '2026-10-22 09:18:19', '7', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=860
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('اوك حمزاوي', 'اوك حمزاوي', 'اوك حمزاوي', 'اوك حمزاوي', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '7', '0', '2026-10-22 09:18:19'); -- id=690
UPDATE supplier SET suppliername = 'اوك حمزاوي', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '7', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='690',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '203';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:49:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:19:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:19:19', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17388
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 ('06ad9aa9f36225', '2026-10-22 09:18:07', '203', '0.00', '86940', '8', '1', '94500.00',  '86940.00', '0', '86940', '1', '2026-10-22 09:19:19', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=316
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 ('02390', '316', '209', '2390', '150', '350', '52500.00', '0', '', '2026-10-22 09:19:19', '2390','','','0','0','0','0','0',null,'350','52500','0','0','0','0','0','0','0','0','1'); -- id=1726
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:18:07', 1, 2390, 0, 0
                    , 322, 150, 0, 0, 7, '2026-10-22 09:19:19')
                ON DUPLICATE KEY UPDATE buyprice = 322,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:19:19' ; -- id=7050
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2390', '350', '150', '0', 'buyBillController.php', '1726', '', '0', '0'); -- id=1274
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2390 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1726 ;
UPDATE product SET productName = 'موديل حروف اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02390',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '322',meanbuyprice = '350',meanbuyprice_withDiscount = '322' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='322',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2390';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 322, meanbuyprice_withDiscount = 322
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where buybilldetailid = 1726;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2390;
UPDATE storedetail SET  productquantity = '150', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '150', '0', '316', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '150', '7', '2026-10-22 09:18:07','0','0'); -- id=16333
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 ('02391', '316', '209', '2391', '30', '440', '13200.00', '0', '', '2026-10-22 09:19:19', '2391','','','0','0','0','0','0',null,'440','13200','0','0','0','0','0','0','0','0','1'); -- id=1727
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:18:07', 1, 2391, 0, 0
                    , 404.8, 30, 0, 0, 7, '2026-10-22 09:19:19')
                ON DUPLICATE KEY UPDATE buyprice = 404.8,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:19:19' ; -- id=7051
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2391', '440', '30', '0', 'buyBillController.php', '1727', '', '0', '0'); -- id=1275
UPDATE product SET  productBuyPrice = "440" WHERE productId = 2391 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1727 ;
UPDATE product SET productName = 'سوستة سادة اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '440.00', productSellAllPrice = '440.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02391',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '404.8',meanbuyprice = '440',meanbuyprice_withDiscount = '404.8' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='404.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2391';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 404.8, meanbuyprice_withDiscount = 404.8
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where buybilldetailid = 1727;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2391;
UPDATE storedetail SET  productquantity = '30', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3786';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2391', '1', '30', '0', '316', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '7', '2026-10-22 09:18:07','0','0'); -- id=16334
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 ('02392', '316', '209', '2392', '60', '480', '28800.00', '0', '', '2026-10-22 09:19:19', '2392','','','0','0','0','0','0',null,'480','28800','0','0','0','0','0','0','0','0','1'); -- id=1728
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:18:07', 1, 2392, 0, 0
                    , 441.6, 60, 0, 0, 7, '2026-10-22 09:19:19')
                ON DUPLICATE KEY UPDATE buyprice = 441.6,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:19:19' ; -- id=7052
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2392', '480', '60', '0', 'buyBillController.php', '1728', '', '0', '0'); -- id=1276
UPDATE product SET  productBuyPrice = "480" WHERE productId = 2392 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1728 ;
UPDATE product SET productName = 'سوستة تطريز اوك حمزاوي', productDescription = '', productCatId = '209', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02392',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '441.6',meanbuyprice = '480',meanbuyprice_withDiscount = '441.6' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='441.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2392';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 441.6, meanbuyprice_withDiscount = 441.6
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 441.6
                where buybilldetailid = 1728;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 2392;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2392', '1', '60', '0', '316', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '7', '2026-10-22 09:18:07','0','0'); -- id=16335
UPDATE supplier SET  suppliercurrentDebt = '86940',suppliercurrentDebtInCurrency= '86940' , userid = '7', supplierdate = '2026-10-22 09:19:19'   WHERE supplierid = '203';
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 ('203', '0.00', '86940', '0', 'اضافة فاتورة مشتريات', '316', '86940', '2026-10-22 09:18:07', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','86940','1','0','86940','86940','0',''); -- id=861
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '86940', '86940', '2026-10-22', '7', '0', '0', '2026-10-22 09:19:19','اضافة فاتورة مشتريات رقم 316','1','0',null,'0','316','buyBillController.php?do=details&id=316'); -- id=4297
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4297', '382', '86940', '','0'); -- id=4411
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25939522.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4297', '690', '86940', '','0'); -- id=4299
UPDATE accountstree SET name = 'اوك حمزاوي', customName = 'اوك حمزاوي', customNameEn = 'اوك حمزاوي', nameEn = 'اوك حمزاوي', parent = '81', accountNature = '1', theValue = '86940', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 09:18:19' WHERE id = '690';
update buybill set dailyentryid='4297,0' where buybillid=316;
COMMIT;
UPDATE product SET overAllAveragePrice = 322 WHERE productId = 2390;UPDATE product SET overAllAveragePrice = 404.8 WHERE productId = 2391;UPDATE product SET overAllAveragePrice = 441.6 WHERE productId = 2392;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:49:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:19:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:19:20', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=316'); -- id=17389
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:49:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:19:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:19:34', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=316&type=2'); -- id=17390
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:50:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:20:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:20:43', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17391
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('اوفر 360 دونجا','','189','360','360','0','0','2026-10-22','0','5','0','','0','0','0','0','0','360','360','360','360','360','0','0','0','0','.','0','0','0','360','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','360','360','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','360','0','0','0','0','0','0','','','0','0','0','0'); -- id=2393
UPDATE product SET productName = 'اوفر 360 دونجا', productDescription = '', productCatId = '189', productBuyPrice = '360', productSellAllPrice = '360', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02393',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2393';
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', '2393', '1.00', '2026-10-22', '5', '0','0239301','360','0','0','360','','0','0','0','0','0','0','0','0','0','0'); -- id=2393
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2393', '1', '0', '5', '2026-10-22'); -- id=3788
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2393', '1', '0', '0', '2393', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16336
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2393, 1,'2026-10-22 09:20:43',5)
                ON DUPLICATE KEY UPDATE productid = 2393, edited = 1, sysdate = '2026-10-22 09:20:43', userid = 5; -- id=3568
UPDATE product SET productName = 'اوفر 360 دونجا', productDescription = '', productCatId = '189', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02393',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2393';
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 ('رجلان 340 دونجا ','','189','340','340','0','0','2026-10-22','0','5','0','','0','0','0','0','0','340','340','340','340','340','0','0','0','0','.','0','0','0','340','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','340','340','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','340','0','0','0','0','0','0','','','0','0','0','0'); -- id=2394
UPDATE product SET productName = 'رجلان 340 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '340', productSellAllPrice = '340', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02394',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340',lastbuyprice_withDiscount = '340',meanbuyprice = '340',meanbuyprice_withDiscount = '340' , productbuypricereal = '340' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='340',meanbuyprice_withTax='340',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2394';
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', '2394', '1.00', '2026-10-22', '5', '0','0239401','340','0','0','340','','0','0','0','0','0','0','0','0','0','0'); -- id=2394
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2394', '1', '0', '5', '2026-10-22'); -- id=3789
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2394', '1', '0', '0', '2394', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16337
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2394, 1,'2026-10-22 09:20:43',5)
                ON DUPLICATE KEY UPDATE productid = 2394, edited = 1, sysdate = '2026-10-22 09:20:43', userid = 5; -- id=3569
UPDATE product SET productName = 'رجلان 340 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02394',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340',lastbuyprice_withDiscount = '340',meanbuyprice = '340',meanbuyprice_withDiscount = '340' , productbuypricereal = '340' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='340',meanbuyprice_withTax='340',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2394';
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 ('رجلان 420 دونجا ','','189','420','420','0','0','2026-10-22','0','5','0','','0','0','0','0','0','420','420','420','420','420','0','0','0','0','.','0','0','0','420','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','420','420','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','420','0','0','0','0','0','0','','','0','0','0','0'); -- id=2395
UPDATE product SET productName = 'رجلان 420 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02395',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2395';
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', '2395', '1.00', '2026-10-22', '5', '0','0239501','420','0','0','420','','0','0','0','0','0','0','0','0','0','0'); -- id=2395
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2395', '1', '0', '5', '2026-10-22'); -- id=3790
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '0', '0', '2395', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16338
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2395, 1,'2026-10-22 09:20:43',5)
                ON DUPLICATE KEY UPDATE productid = 2395, edited = 1, sysdate = '2026-10-22 09:20:43', userid = 5; -- id=3570
UPDATE product SET productName = 'رجلان 420 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02395',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2395';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:50:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:20:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:20:44', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17392
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:50:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:20:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:20:48', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17393
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:51:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:21:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:21:27', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=316&type=2'); -- id=17394
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:51:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:21:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:21:38', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17395
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:51:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:21:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:21:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17396
UPDATE productunit SET unitid = '1', productid = '2394', productnumber = '1.00', productunitdate = '2026-10-22', userid = '5', conditions = '0',proUnitParcode='0239401',proUnitSellAllPrice='340',proUnitSellHalfPrice='430',proUnitSellUnitPrice ='430',proUnitBuyPrice='340',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '2394';
UPDATE product SET productName = 'رجلان 340 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '430', productSellAllPrice = '430', productSellUnitPrice = '430', productSellHalfPrice = '430', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02394',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='340',meanbuyprice_withTax='340',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2394';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:52:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:22:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:22:20', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17397
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:52:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:22:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:22:25', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17398
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:54:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:24:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:24:12', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17399
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:54:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:24:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:24:12', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17400
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:54:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:24:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:24:20', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17401
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 ('06ad9ab40a8448', '2026-10-22 09:20:48', '148', '49.40', '56463.2', '7', '1', '60660.00',  '56413.80', '0', '56413.8', '1', '2026-10-22 09:24:21', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=317
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 ('02393', '317', '189', '2393', '33', '360', '11880.00', '0', '', '2026-10-22 09:24:21', '2393','','','0','0','0','0','0',null,'360','11880','0','0','0','0','0','0','0','0','1'); -- id=1729
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:20:48', 1, 2393, 0, 0
                    , 334.8, 33, 0, 0, 5, '2026-10-22 09:24:21')
                ON DUPLICATE KEY UPDATE buyprice = 334.8,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:24:21' ; -- id=7053
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2393', '360', '33', '0', 'buyBillController.php', '1729', '', '0', '0'); -- id=1277
UPDATE product SET  productBuyPrice = "360" WHERE productId = 2393 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1729 ;
UPDATE product SET productName = 'اوفر 360 دونجا', productDescription = '', productCatId = '189', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02393',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '334.8',meanbuyprice = '360',meanbuyprice_withDiscount = '334.8' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='334.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2393';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 360, lastbuyprice_withDiscount = 334.8, meanbuyprice_withDiscount = 334.8
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where buybilldetailid = 1729;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 2393;
UPDATE storedetail SET  productquantity = '33', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2393', '1', '33', '0', '317', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '5', '2026-10-22 09:20:48','0','0'); -- id=16339
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 ('02394', '317', '189', '2394', '33', '430', '14190.00', '0', '', '2026-10-22 09:24:21', '2394','','','0','0','0','0','0',null,'430','14190','0','0','0','0','0','0','0','0','1'); -- id=1730
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:20:48', 1, 2394, 0, 0
                    , 399.9, 33, 0, 0, 5, '2026-10-22 09:24:21')
                ON DUPLICATE KEY UPDATE buyprice = 399.9,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:24:21' ; -- id=7054
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2394', '430', '33', '0', 'buyBillController.php', '1730', '', '0', '0'); -- id=1278
UPDATE product SET  productBuyPrice = "430" WHERE productId = 2394 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1730 ;
UPDATE product SET productName = 'رجلان 340 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '430.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02394',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '399.9',meanbuyprice = '430',meanbuyprice_withDiscount = '399.9' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='399.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 = '2394';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 399.9, meanbuyprice_withDiscount = 399.9
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 399.9
                where buybilldetailid = 1730;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 2394;
UPDATE storedetail SET  productquantity = '33', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3789';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2394', '1', '33', '0', '317', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '5', '2026-10-22 09:20:48','0','0'); -- id=16340
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 ('02165', '317', '189', '2165', '33', '590', '19470.00', '0', '', '2026-10-22 09:24:21', '2165','','','0','0','0','0','0',null,'590','19470','0','0','0','0','0','0','0','0','1'); -- id=1731
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:20:48', 1, 2165, 0, 0
                    , 548.7, 33, 0, 0, 5, '2026-10-22 09:24:21')
                ON DUPLICATE KEY UPDATE buyprice = 548.7,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:24:21' ; -- id=7055
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2165', '590', '33', '0', 'buyBillController.php', '1731', '', '0', '0'); -- id=1279
UPDATE product SET  productBuyPrice = "590" WHERE productId = 2165 ;
UPDATE buybilldetail SET  quantitybefore = 30 WHERE buybilldetailid = 1731 ;
UPDATE product SET productName = 'مستورد دونجا', productDescription = '', productCatId = '189', productBuyPrice = '590.00', productSellAllPrice = '590.00', productSellUnitPrice = '590.00', productSellHalfPrice = '590.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02165',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '590',lastbuyprice_withDiscount = '548.7',meanbuyprice = '590',meanbuyprice_withDiscount = '548.7' , productbuypricereal = '590.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='548.7',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='590',meanbuyprice_withTax='590',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='548.7',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2165';
UPDATE buybilldetail SET  lastbuyprice = 590 , meanbuyprice = 590, lastbuyprice_withDiscount = 548.7, meanbuyprice_withDiscount = 548.7
        , lastbuyprice_withTax = 590, meanbuyprice_withTax = 590, lastbuyprice_withDiscountAndTax = 548.7
                where buybilldetailid = 1731;
UPDATE productunit SET proUnitBuyPrice  = 590 * productnumber WHERE productid = 2165;
UPDATE storedetail SET  productquantity = '63', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3524';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2165', '1', '33', '0', '317', 'اضافة فاتورة مشتريات', 'buyBillController.php', '30', '63', '5', '2026-10-22 09:20:48','0','0'); -- id=16341
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 ('02395', '317', '189', '2395', '36', '420', '15120.00', '0', '', '2026-10-22 09:24:21', '2395','','','0','0','0','0','0',null,'420','15120','0','0','0','0','0','0','0','0','1'); -- id=1732
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:20:48', 1, 2395, 0, 0
                    , 390.6, 36, 0, 0, 5, '2026-10-22 09:24:21')
                ON DUPLICATE KEY UPDATE buyprice = 390.6,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:24:21' ; -- id=7056
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2395', '420', '36', '0', 'buyBillController.php', '1732', '', '0', '0'); -- id=1280
UPDATE product SET  productBuyPrice = "420" WHERE productId = 2395 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1732 ;
UPDATE product SET productName = 'رجلان 420 دونجا ', productDescription = '', productCatId = '189', productBuyPrice = '420.00', productSellAllPrice = '420.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02395',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '390.6',meanbuyprice = '420',meanbuyprice_withDiscount = '390.6' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='390.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2395';
UPDATE buybilldetail SET  lastbuyprice = 420 , meanbuyprice = 420, lastbuyprice_withDiscount = 390.6, meanbuyprice_withDiscount = 390.6
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 390.6
                where buybilldetailid = 1732;
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 2395;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '36', '0', '317', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 09:20:48','0','0'); -- id=16342
UPDATE supplier SET  suppliercurrentDebt = '56463.2',suppliercurrentDebtInCurrency= '56463.2' , userid = '5', supplierdate = '2026-10-22 09:24:21'   WHERE supplierid = '148';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('148', '49.40', '56413.8', '0', 'اضافة فاتورة مشتريات', '317', '56463.2', '2026-10-22 09:20:48', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','56413.8','1','49.4','56413.8','56463.2','0',''); -- id=862
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '56413.8', '56413.8', '2026-10-22', '5', '0', '0', '2026-10-22 09:24:21','اضافة فاتورة مشتريات رقم 317','1','0',null,'0','317','buyBillController.php?do=details&id=317'); -- id=4298
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4298', '382', '56413.8', '','0'); -- id=4412
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25995936.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4298', '631', '56413.8', '','0'); -- id=4300
UPDATE accountstree SET name = 'دونجا - مورد', customName = 'دونجا - مورد', customNameEn = 'دونجا - مورد', nameEn = 'دونجا - مورد', parent = '81', accountNature = '1', theValue = '56463.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:35:34' WHERE id = '631';
update buybill set dailyentryid='4298,0' where buybillid=317;
COMMIT;
UPDATE product SET overAllAveragePrice = 548.7 WHERE productId = 2165;UPDATE product SET overAllAveragePrice = 334.8 WHERE productId = 2393;UPDATE product SET overAllAveragePrice = 399.9 WHERE productId = 2394;UPDATE product SET overAllAveragePrice = 390.6 WHERE productId = 2395;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:54:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:24:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:24:21', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=317'); -- id=17402
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:54:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:24:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:24:23', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=317&type=2'); -- id=17403
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:25:04', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17404

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9aba1ddb37
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 09:25:04', '06ad9aba1ddb37', '1', '0.00', '0', '0', '1', '1540', '1540', '-1540', '0', '1', '2026-10-22 09:25:04', '', '6', '0', 'نقدي','4', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-1540','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=41
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','41', '0', '2026-10-22 09:25:04', '6', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1540', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:25:04','0','0','',''); -- id=1439
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('740.00', '01845', '41', '143', '1845', '2', '770', '1540', '0', '', '0', '0', '1845', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','770','1540','0','','0'); -- id=59
UPDATE returnsellbilldetail SET  lastbuyprice = 740.00 , meanbuyprice = 740.00, lastbuyprice_withDiscount = 740.00, meanbuyprice_withDiscount = 740.00
        , lastbuyprice_withTax = 740, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 740
                where returnsellbilldetailid = 59;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1845, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1540, 1480, 1480, 1480
                    , 1480, 1480, 1480, 0, 2, 0, 0, 1480, 740)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1540, returnSellCostBuyPrice = returnSellCostBuyPrice+1480, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1480
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1480, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1480
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1480
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1480
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1480
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+740
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1540, 1480, 1480, 1480
                    , 1480, 1480, 1480, 0, 0, 1480, 740)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1540, returnSellCostBuyPrice = returnSellCostBuyPrice+1480, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1480
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1480, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1480
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1480
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1480
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1480
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+740;
UPDATE storedetail SET  productquantity = '14', userid = '6', storedetaildate = '2026-10-22 09:25:04' WHERE storedetailid = '2862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1845', '1', '2', '0', '41', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '12', '14', '6', '2026-10-22 09:25:04','0','0'); -- id=16343
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1038760',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1040300','-1540', '1', '4', 'اضافة فاتورة مردوات مبيعات', '41', '1038760', '2026-10-22 09:25:04', '6',  'returnsellbillController.php','1','','0'); -- id=1513
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1540', '1540', '2026-10-22', '6', '0', '0', '2026-10-22 09:25:04','اضافة فاتورة مردود مبيعات رقم 41','1','0',null,'0','41','returnsellbillController.php?do=showDetail&returnsellbillid=41'); -- id=4299
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4299', '143', '1540', '','0'); -- id=4413
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13716485', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4299', '568', '1540', '','0'); -- id=4301
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1038760', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1480', '1480', '2026-10-22', '6', '0', '0', '2026-10-22 09:25:04','اضافة فاتورة مردود مبيعات رقم 41 - صرف البضاعة من المخزن','1','0',null,'0','41','returnsellbillController.php?do=showDetail&returnsellbillid=41'); -- id=4300
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4300', '382', '1480', '','0'); -- id=4414
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25997416.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4300', '402', '1480', '','0'); -- id=4302
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12690225.41', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4299,0,4300' where returnsellbillid=41;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1540, 1480, 1480, 1480
                    , 1480, 1480, 1480 ,0, 0, 1480, 740)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1540, returnSellCostBuyPrice = returnSellCostBuyPrice+1480, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1480
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1480, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1480
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1480
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1480
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1480
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+740;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1540, 1480, 1480, 1480
                    , 1480, 1480, 1480 ,0, 0, 1480, 740)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1540, returnSellCostBuyPrice = returnSellCostBuyPrice+1480, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1480
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1480, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1480
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1480
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1480
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1480
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+740;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1540, -1480, -1480
                    , -1480, -1480, -1480, -1480, -1480, -740)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1540, netSellCostBuyPrice = netSellCostBuyPrice+-1480
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1480
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1480
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1480
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1480
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1480
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1480
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-740;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9aba1ddb37 and sellbillId = 41 and returnsellbillId = 41
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:25:04', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17405
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:25:05', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17406
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:25:17', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=317&type=2'); -- id=17407
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:25:19', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17408
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:25:30', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17409
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:25:48', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17410
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:25:51', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=317'); -- id=17411
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:55:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:25:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:25:53', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=317&type=2'); -- id=17412
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:56:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:26:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:26:50', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17413
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:56:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:26:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:26:50', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17414
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:56:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:26:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:26:52', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=317&type=2'); -- id=17415
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:56:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:26:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:26:54', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=317'); -- id=17416
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:57:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:27:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:27:12', '5', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17417
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:57:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:27:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:27:25', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=317'); -- id=17418
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:57:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:27:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:27:26', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17419
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:57:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:27:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:27:27', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17420
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:57:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:27:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:27:27', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=317&type=2'); -- id=17421
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:59:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:29:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:29:45', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17422

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9a7ac6e5dd
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9a7ac6e5dd and sellbillId = 1212 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 05:59:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:29:46", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:29:46', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17423
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:06";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:30:12', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17424
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:13";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:30:13', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17425
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:30:29', '5', 'sellandreturnreport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=sellandreturnreport'); -- id=17426
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:36', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17427
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:42', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=6'); -- id=17428
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:46', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17429
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:50', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=5'); -- id=17430
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:52', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17431
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:55', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=1'); -- id=17432
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:00:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:30:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:30:58', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17433
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:01:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:31:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:31:02', '5', 'sellandreturnreport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=sellandreturnreport'); -- id=17434
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:01:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:31:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:31:08', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17435
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:01:08";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:31:08', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17436
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:01:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:31:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:31:21', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17437
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:32:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:32:15', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=310'); -- id=17438
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:32:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:32:35', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17439
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:40";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:32:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:32:40', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=show'); -- id=17440
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:32:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:32:55', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17441
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:02:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:32:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:32:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17442
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:33:12', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=310'); -- id=17443
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:33:21', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17444
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:33:31', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17445
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:31";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:33:31', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17446
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:33:34', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17447
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:33:34', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17448
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('salesreportbills.php', '2026-10-22 09:33:35', '7', 'reviewbills', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/salesreportbills.php?do=reviewbills'); -- id=17449
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBillreportController.php', '2026-10-22 09:33:37', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnBillreportController.php'); -- id=17450
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:33:39', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17451
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:33:41', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17452
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:33:43', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=show'); -- id=17453
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:33:44', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=310'); -- id=17454
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:33:44', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17455
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:33:44', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17456
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:44";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:33:44', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17457
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:33:44', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17458

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9acaa43f94
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 09:33:44', '06ad9acaa43f94', '1', '0.00', '0', '0', '1', '18730.00', '18730', '18730', '0', '1', '2026-10-22 09:33:44', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '35' ,'0','','','','','-1','0','0','0','0','0','18730','0','','0','0','18730','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1213
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1213', '0', '2026-10-22 09:33:44', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '18730', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:33:44','0','0','',''); -- id=1441
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 1143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('598','01954', '1213', '158', '1954', '8', '650', '5200', '0', '', '0', '2026-10-22 09:33:44', '1954', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1143-8,','1','1','0','0','650','5200','0','','0','0.00','0','0','0','0'); -- id=4898
UPDATE sellbilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 667.88, lastbuyprice_withDiscount = 598.00, meanbuyprice_withDiscount = 612.29
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 667.88, lastbuyprice_withDiscountAndTax = 598
                where sellbilldetailid = 4898;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1954, '2026-10-22', 5200, 5200, 5200
                    , 5343.04, 4784, 4898.32, 4784
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 5200, 5343.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5200, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5343.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4784, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4898.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4784
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5343.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5200, 5200, 5200
                    , 5343.04, 4784, 4898.32, 4784
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5200, 5343.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5200, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5343.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4784, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4898.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4784
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5343.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '44', userid = '3', storedetaildate = '2026-10-22 09:33:44' WHERE storedetailid = '2971';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1954', '1', '8', '1', '1213', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '44', '3', '2026-10-22 09:33:44','0','0'); -- id=16345
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('511.5','02031', '1213', '166', '2031', '12', '550', '6600', '0', '', '0', '2026-10-22 09:33:44', '2031', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6955-12,','1','1','0','0','550','6600','0','','0','0.00','0','0','0','0'); -- id=4899
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 511.50, meanbuyprice_withDiscount = 510.62
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 511.5
                where sellbilldetailid = 4899;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2031, '2026-10-22', 6600, 6600, 6600
                    , 6600, 6138, 6127.44, 6121.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6138, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6127.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6121.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6600, 6600, 6600
                    , 6600, 6138, 6127.44, 6121.44
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6600, 6600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6600, sellCostBuyPrice =sellCostBuyPrice+6600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6138, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6127.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6121.44
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '3', storedetaildate = '2026-10-22 09:33:44' WHERE storedetailid = '3390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2031', '1', '12', '1', '1213', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '48', '3', '2026-10-22 09:33:44','0','0'); -- id=16346
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1213', '207', '2381', '12', '470', '5640', '0', '', '0', '2026-10-22 09:33:44', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-12,','1','1','0','0','470','5640','0','','0','0.00','0','0','0','0'); -- id=4900
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4900;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 5640, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5640, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5640, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5640, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '485', userid = '3', storedetaildate = '2026-10-22 09:33:44' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '12', '1', '1213', 'اضافة فاتورة مبيعات', 'sellbillController.php', '497', '485', '3', '2026-10-22 09:33:44','0','0'); -- id=16347
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6244;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395.6','02152', '1213', '188', '2152', '3', '430', '1290', '0', '', '0', '2026-10-22 09:33:44', '2152', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6244-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=4901
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 395.60, meanbuyprice_withDiscount = 395.60
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 395.6
                where sellbilldetailid = 4901;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2152, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1186.8, 1186.8, 1186.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1186.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1186.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1186.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1186.8, 1186.8, 1186.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1186.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1186.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1186.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-22 09:33:45' WHERE storedetailid = '3511';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2152', '1', '3', '1', '1213', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '3', '2026-10-22 09:33:45','0','0'); -- id=16348
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7547018.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7528288.5','18730', '0', '2', 'اضافة فاتورة مبيعات', '1213', '7547018.5', '2026-10-22 09:33:45', '3',  'sellbillController.php','1','','0'); -- id=1515
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18730', '18730', '2026-10-22', '3', '0', '0', '2026-10-22 09:33:45','اضافة فاتورة مبيعات رقم 1213','1','0',null,'0','1213','sellbillController.php?do=showDetail&sellbillid=1213'); -- id=4303
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4303', '419', '18730', '','0'); -- id=4417
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7547018', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4303', '143', '18730', '','0'); -- id=4305
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13738005', 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 ( '17508.8', '17508.8', '2026-10-22', '3', '0', '0', '2026-10-22 09:33:45','اضافة فاتورة مبيعات رقم 1213 - صرف البضاعة من المخزن','1','0',null,'0','1213','sellbillController.php?do=showDetail&sellbillid=1213'); -- id=4304
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4304', '402', '17508.8', '','0'); -- id=4418
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12710434.21', 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 ('4304', '382', '17508.8', '','0'); -- id=4306
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '25977207.29', 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='4303,0,4304' where sellbillid=1213;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 18730, 18490, 18490
                    , 18633.04, 17508.8, 17612.56, 17492.24
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18490, 18633.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18730, sellCostBuyPrice =sellCostBuyPrice+18490
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18490, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18633.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17508.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17612.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17492.24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18490
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18633.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 18730, 18490, 18490
                    , 18633.04, 17508.8, 17612.56, 17492.24
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18490, 18633.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18730, sellCostBuyPrice =sellCostBuyPrice+18490
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18490, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18633.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17508.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17612.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17492.24
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18490
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18633.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 18730, 18490, 18490
                    , 18633.04, 17508.8, 17612.56, 17492.24, 18490, 18633.04)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+18730, netSellCostBuyPrice = netSellCostBuyPrice+18490
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18490
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18633.04
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+17508.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+17612.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+17492.24
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18490
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18633.04;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9acaa43f94 and sellbillId = 1213 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:33:45', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:03:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:33:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:33:49', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17460
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:01', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17461
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:05', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17462
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:11', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=1'); -- id=17463
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:13', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17464
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:34:14', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:34:14', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17466
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:17', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=6'); -- id=17467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:34:19', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=310'); -- id=17468
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:20', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17469
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:23', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=5'); -- id=17470
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:25', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17471
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:34:26', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=17472
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:34:33', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=17473
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:34:35', '5', 'sellandreturnreport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=sellandreturnreport'); -- id=17474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:34:38', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17475
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:34:39', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17476
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:39";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:34:39', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:04:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:34:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:34:47', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17478
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:35:01', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=310'); -- id=17479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:35:08', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17480
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:35:08', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17481
UPDATE supplier SET suppliername = '', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '', supplierdetails = '', conditions = null, userid = null, supplierdate = '', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='-1',sullpierCurrencyid='0',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = null;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:35:39', '5', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=17482
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 310;
UPDATE buybill SET  buybillsysdate = '2026-10-22 09:35:39', userid = '5',delbyuserid = '5', conditions = '1' WHERE buybillid = '310';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2380, 0, 0
                    , 430, 500, 0, 0, 5, '2026-10-22 09:35:39')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-500, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:35:39' ; -- id=7031
UPDATE buybilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430.00, meanbuyprice_withTax = 430.00, lastbuyprice_withDiscountAndTax = 430.00
                where buybilldetailid = 1710;
UPDATE product SET productName = 'موديل 450 الشايب ', productDescription = '', productCatId = '207', productBuyPrice = '430.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02380',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '0',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.65' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2380';
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 2380;
UPDATE storedetail SET  productquantity = '-6', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '500', '1', '310', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '494', '-6', '5', '2026-10-22 08:24:10','0','0'); -- id=16349
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2381, 0, 0
                    , 450, 500, 0, 0, 5, '2026-10-22 09:35:39')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-500, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:35:39' ; -- id=7032
UPDATE buybilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450.00, meanbuyprice_withTax = 450.00, lastbuyprice_withDiscountAndTax = 450.00
                where buybilldetailid = 1711;
UPDATE product SET productName = 'موديل 470 الشايب', productDescription = '', productCatId = '207', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02381',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '0',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '2381';
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2381;
UPDATE storedetail SET  productquantity = '-15', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '500', '1', '310', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '485', '-15', '5', '2026-10-22 08:24:10','0','0'); -- id=16350
UPDATE supplier SET  suppliercurrentDebt = '0',suppliercurrentDebtInCurrency= '-3150' , userid = '5', supplierdate = '2026-10-22 09:35:39'   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', '440000.00', '440000.00', '1', 'حذف فاتورة مشتريات - للتعديل', '310', '0', '2026-10-22 08:24:10', '5', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','440000','1','436850','440000','-3150','0',''); -- id=863
UPDATE productserial SET del = 1
		 WHERE billid = 310;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ad99dfaecfc4', '2026-10-22 08:24:10', '139', '-1100000.00', '-660000', '0', '0', '440000.00', '440000.00', '0.00', '440000', '1', '2026-10-22 09:35:39', '', '5', '0', '', '1', '1','1','310','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=318
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 ('02380', '318', '207', '2380', '500.00', '430', '215000.00', '0.00', '', '2026-10-22 09:35:39', '2380','','','0','0','0','0','0',null,'430','215000','0','0','0','0','0','0','0','0','1'); -- id=1733
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2380, 0, 0
                    , 430, 500, 0, 0, 5, '2026-10-22 09:35:39')
                ON DUPLICATE KEY UPDATE buyprice = 430,
                        buyQuantity =buyQuantity+500, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:35:39' ; -- id=7031
UPDATE product SET  productBuyPrice = "430" WHERE productId = 2380 ;
UPDATE buybilldetail SET  quantitybefore = -6 WHERE buybilldetailid = 1733 ;
UPDATE product SET productName = 'موديل 450 الشايب ', productDescription = '', productCatId = '207', productBuyPrice = '430.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02380',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.65' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2380';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 430, meanbuyprice_withDiscount = 430
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where buybilldetailid = 1733;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 2380;
UPDATE storedetail SET  productquantity = '494', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '500', '0', '318', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-6', '494', '5', '2026-10-22 08:24:10','0','0'); -- id=16351
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 ('02381', '318', '207', '2381', '500.00', '450', '225000.00', '0.00', '', '2026-10-22 09:35:39', '2381','','','0','0','0','0','0',null,'450','225000','0','0','0','0','0','0','0','0','1'); -- id=1734
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 08:24:10', 1, 2381, 0, 0
                    , 450, 500, 0, 0, 5, '2026-10-22 09:35:39')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+500, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:35:39' ; -- id=7032
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2381 ;
UPDATE buybilldetail SET  quantitybefore = -15 WHERE buybilldetailid = 1734 ;
UPDATE product SET productName = 'موديل 470 الشايب', productDescription = '', productCatId = '207', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02381',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2381';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1734;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2381;
UPDATE storedetail SET  productquantity = '485', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '500', '0', '318', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-15', '485', '5', '2026-10-22 08:24:10','0','0'); -- id=16352
DELETE FROM productserial WHERE billid = 310
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '-660000',suppliercurrentDebtInCurrency= '-660000' , userid = '5', supplierdate = '2026-10-22 09:35:39'   WHERE supplierid = '139';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('139', '-1100000.00', '440000', '0', 'اضافة فاتورة مشتريات', '318', '-660000', '2026-10-22 09:35:39', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','440000','1','-1100000','440000','-660000','0',''); -- id=864
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '440000', '440000', '2026-10-22', '5', '0', '0', '2026-10-22 09:35:39','اضافة فاتورة مشتريات رقم 318','1','0',null,'0','318','buyBillController.php?do=details&id=318'); -- id=4305
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4305', '382', '440000', '','0'); -- id=4419
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26417207.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4305', '622', '440000', '','0'); -- id=4307
UPDATE accountstree SET name = 'الشايب', customName = 'الشايب', customNameEn = 'الشايب', nameEn = 'الشايب', parent = '81', accountNature = '1', theValue = '-660000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:12:38' WHERE id = '622';
update buybill set dailyentryid='4305,0' where buybillid=318;
UPDATE product SET overAllAveragePrice = 430 WHERE productId = 2380;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2381;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:35:40', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=318'); -- id=17483
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:35:46', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=310'); -- id=17484
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:05:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:35:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:35:48', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17485
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:36:06', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17486

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ae9c5c3d5
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ae9c5c3d5 and sellbillId = 1214 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:36:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:36:35', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17488
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:39", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:36:39', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=318'); -- id=17489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:36:42', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17490
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:36:46', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17491
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:36:53', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17492
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:36:53', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17493
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:36:54', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17494
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:06:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:36:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:36:57', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17495
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:10', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17496
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:11', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17497
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:17', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=6'); -- id=17498
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:19', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17499
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:21', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=1'); -- id=17500
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:24', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17501
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:27', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=5'); -- id=17502
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:29', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17503
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:33', '5', 'edit', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=edit&id=3'); -- id=17504
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:37:35', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17505
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:37:50', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17506
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:37:50', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17507
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:37:53', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=318'); -- id=17508
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:07:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:37:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:37:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17509
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:01", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:38:01', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17510

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ad5a3b2a5
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ad5a3b2a5 and sellbillId = 1215 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:02", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:38:02', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17511
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:06', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17512
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:07', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17513
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:07', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17514
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:07', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17515
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:13', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=318'); -- id=17516
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:17", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:38:17', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17517
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:17";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:38:17', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17518
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 09:38:17', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=17519
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:38:17', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17520
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:18', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17521
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:38:35', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17522
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:38:37', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17523
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:38:38', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17524
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:38:38', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17525
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:38:38', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17526
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:38:38', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17527
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:38";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:38:38', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17528
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:38:39', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17529
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:39";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:38:39', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17530
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:41", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:38:41', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17531
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:41", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:38:41', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17532
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:49", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:38:49', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1213'); -- id=17533
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:38:54', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17534
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:08:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:38:56", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:38:56', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1214'); -- id=17535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:39:01', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:39:01', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:39:05', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17538
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:39:05', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17539
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:39:07', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17540
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:39:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17541
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:39:23', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:09:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:39:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:39:42', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17543
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:40:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:40:09', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17544
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:09";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 09:40:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:40:09', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17545
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:40:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:40:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17546
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:40:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:40:25', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17547

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9a8680501f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 09:40:25', '06ad9a8680501f', '1', '0.00', '0', '5', '1', '56655.00', '56650', '56650', '0', '1', '2026-10-22 09:40:25', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '124' ,'0','','','','','-1','0','0','0','0','0','56650','0','','0','0','56650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1216
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1216', '0', '2026-10-22 09:40:25', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '56650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:40:25','0','0','',''); -- id=1444
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1216', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 09:40:25', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=4904
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4904;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '488', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '494', '488', '2', '2026-10-22 09:40:25','0','0'); -- id=16355
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1216', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 09:40:25', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=4905
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4905;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4229.6266878475, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4229.6266878475, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4229.6266878475, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4229.6266878475, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '473', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '482', '473', '2', '2026-10-22 09:40:25','0','0'); -- id=16356
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 684;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('490','01770', '1216', '137', '1770', '8', '530', '4240', '0', '', '0', '2026-10-22 09:40:25', '1770', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','684-8,','1','1','0','0','530','4240','0','','0','0.00','0','0','0','0'); -- id=4906
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 490.00, meanbuyprice_withDiscount = 490.00
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 490
                where sellbilldetailid = 4906;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1770, '2026-10-22', 4239.6258053129, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3920, 3920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4239.6258053129, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4239.6258053129, 3920, 3920
                    , 3920, 3920, 3920, 3920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3920, 3920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4239.6258053129, sellCostBuyPrice =sellCostBuyPrice+3920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1770', '1', '8', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '28', '2', '2026-10-22 09:40:25','0','0'); -- id=16357
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 1182;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423','01983', '1216', '160', '1983', '6', '470', '2820', '0', '', '0', '2026-10-22 09:40:25', '1983', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1182-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=4907
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 423.00, meanbuyprice_withDiscount = 423.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 423
                where sellbilldetailid = 4907;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1983, '2026-10-22', 2819.7511252317, 2820, 2820
                    , 2820, 2538, 2538, 2538
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2819.7511252317, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2538, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2538
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2538
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2819.7511252317, 2820, 2820
                    , 2820, 2538, 2538, 2538
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2819.7511252317, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2538, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2538
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2538
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '99', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3000';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1983', '1', '6', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105', '99', '2', '2026-10-22 09:40:25','0','0'); -- id=16358
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 6709;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','00030', '1216', '40', '1121', '10', '290', '2900', '0', '', '0', '2026-10-22 09:40:25', '1121', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6709-10,','1','1','0','0','290','2900','0','','0','0.00','0','0','0','0'); -- id=4908
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.23, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.23
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260.23, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 4908;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1121, '2026-10-22', 2899.7440649545, 2600, 2600
                    , 2602.3, 2600, 2602.3, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 2600, 2602.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2899.7440649545, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2602.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2602.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2602.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2899.7440649545, 2600, 2600
                    , 2602.3, 2600, 2602.3, 2600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2600, 2602.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2899.7440649545, sellCostBuyPrice =sellCostBuyPrice+2600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2602.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2602.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2602.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '634', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '1121';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1121', '1', '10', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '644', '634', '2', '2026-10-22 09:40:25','0','0'); -- id=16359
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 42;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('555','01350', '1216', '31', '1350', '5', '575', '2875', '0', '', '0', '2026-10-22 09:40:25', '1350', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','42-5,','1','1','0','0','575','2875','0','','0','0.00','0','0','0','0'); -- id=4909
UPDATE sellbilldetail SET  lastbuyprice = 555.00 , meanbuyprice = 555.00, lastbuyprice_withDiscount = 555.00, meanbuyprice_withDiscount = 555.00
        , lastbuyprice_withTax = 555, meanbuyprice_withTax = 555
                where sellbilldetailid = 4909;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1350, '2026-10-22', 2874.7462712911, 2775, 2775
                    , 2775, 2775, 2775, 2775
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2775, 2775, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2874.7462712911, sellCostBuyPrice =sellCostBuyPrice+2775
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2775, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2775
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2775, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2775
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2775
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2775
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2775
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2874.7462712911, 2775, 2775
                    , 2775, 2775, 2775, 2775
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2775, 2775, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2874.7462712911, sellCostBuyPrice =sellCostBuyPrice+2775
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2775, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2775
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2775, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2775
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2775
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2775
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2775
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '1350';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1350', '1', '5', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '30', '2', '2026-10-22 09:40:25','0','0'); -- id=16360
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1216', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 09:40:25', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=4910
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4910;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '482', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '488', '482', '2', '2026-10-22 09:40:25','0','0'); -- id=16361
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 978;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('429','01884', '1216', '147', '1884', '3', '460', '1380', '0', '', '0', '2026-10-22 09:40:25', '1884', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','978-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=4911
UPDATE sellbilldetail SET  lastbuyprice = 429.00 , meanbuyprice = 429.00, lastbuyprice_withDiscount = 429.00, meanbuyprice_withDiscount = 429.00
        , lastbuyprice_withTax = 429, meanbuyprice_withTax = 429, lastbuyprice_withDiscountAndTax = 429
                where sellbilldetailid = 4911;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1884, '2026-10-22', 1379.8782102198, 1287, 1287
                    , 1287, 1287, 1287, 1287
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1287, 1287, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1379.8782102198, sellCostBuyPrice =sellCostBuyPrice+1287
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1287, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1287
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1287, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1287
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1287
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1287
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1287
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1379.8782102198, 1287, 1287
                    , 1287, 1287, 1287, 1287
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1287, 1287, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1379.8782102198, sellCostBuyPrice =sellCostBuyPrice+1287
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1287, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1287
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1287, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1287
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1287
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1287
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1287
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '183', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2901';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1884', '1', '3', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '186', '183', '2', '2026-10-22 09:40:25','0','0'); -- id=16362
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 36;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('485','01344', '1216', '31', '1344', '5', '505', '2525', '0', '', '0', '2026-10-22 09:40:25', '1344', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','36-5,','1','1','0','0','505','2525','0','','0','0.00','0','0','0','0'); -- id=4912
UPDATE sellbilldetail SET  lastbuyprice = 485.00 , meanbuyprice = 485.00, lastbuyprice_withDiscount = 485.00, meanbuyprice_withDiscount = 485.00
        , lastbuyprice_withTax = 485, meanbuyprice_withTax = 485, lastbuyprice_withDiscountAndTax = 485
                where sellbilldetailid = 4912;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1344, '2026-10-22', 2524.7771600035, 2425, 2425
                    , 2425, 2425, 2425, 2425
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2425, 2425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2524.7771600035, sellCostBuyPrice =sellCostBuyPrice+2425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2425, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2425
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2425
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2524.7771600035, 2425, 2425
                    , 2425, 2425, 2425, 2425
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2425, 2425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2524.7771600035, sellCostBuyPrice =sellCostBuyPrice+2425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2425, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2425
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2425
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '1344';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1344', '1', '5', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '20', '2', '2026-10-22 09:40:25','0','0'); -- id=16363
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1216', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 09:40:25', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=4913
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4913;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1409.8755626158, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1409.8755626158, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1409.8755626158, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1409.8755626158, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '470', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '473', '470', '2', '2026-10-22 09:40:25','0','0'); -- id=16364
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 978;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('429','01884', '1216', '147', '1884', '9', '460', '4140', '0', '', '0', '2026-10-22 09:40:25', '1884', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','978-9,','1','1','0','0','460','4140','0','','0','0.00','0','0','0','0'); -- id=4914
UPDATE sellbilldetail SET  lastbuyprice = 429.00 , meanbuyprice = 429.00, lastbuyprice_withDiscount = 429.00, meanbuyprice_withDiscount = 429.00
        , lastbuyprice_withTax = 429, meanbuyprice_withTax = 429, lastbuyprice_withDiscountAndTax = 429
                where sellbilldetailid = 4914;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1884, '2026-10-22', 4139.6346306593, 3861, 3861
                    , 3861, 3861, 3861, 3861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3861, 3861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4139.6346306593, sellCostBuyPrice =sellCostBuyPrice+3861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4139.6346306593, 3861, 3861
                    , 3861, 3861, 3861, 3861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3861, 3861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4139.6346306593, sellCostBuyPrice =sellCostBuyPrice+3861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '174', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2901';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1884', '1', '9', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '183', '174', '2', '2026-10-22 09:40:25','0','0'); -- id=16365
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1216', '147', '1887', '3', '410', '1230', '0', '', '0', '2026-10-22 09:40:25', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-3,','1','1','0','0','410','1230','0','','0','0.00','0','0','0','0'); -- id=4915
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 4915;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '273', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '3', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '276', '273', '2', '2026-10-22 09:40:25','0','0'); -- id=16366
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1216', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 09:40:25', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=4916
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4916;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2699.7617156473, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2699.7617156473, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '476', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '482', '476', '2', '2026-10-22 09:40:25','0','0'); -- id=16367
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1216', '147', '1887', '3', '410', '1230', '0', '', '0', '2026-10-22 09:40:25', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-3,','1','1','0','0','410','1230','0','','0','0.00','0','0','0','0'); -- id=4917
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 4917;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '270', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '3', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '273', '270', '2', '2026-10-22 09:40:25','0','0'); -- id=16368
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1216', '207', '2380', '15', '450', '6750', '0', '', '0', '2026-10-22 09:40:25', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-15,','1','1','0','0','450','6750','0','','0','0.00','0','0','0','0'); -- id=4918
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4918;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 6749.4042891183, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6749.4042891183, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6749.4042891183, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6749.4042891183, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '461', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '15', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '476', '461', '2', '2026-10-22 09:40:25','0','0'); -- id=16369
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1216', '147', '1887', '3', '410', '1230', '0', '', '0', '2026-10-22 09:40:25', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-3,','1','1','0','0','410','1230','0','','0','0.00','0','0','0','0'); -- id=4919
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 4919;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1229.8914482393, 1137, 1137
                    , 1137, 1137, 1137, 1137
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1137, 1137, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1229.8914482393, sellCostBuyPrice =sellCostBuyPrice+1137
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1137, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1137
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1137, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1137
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1137
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1137
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1137
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '267', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '3', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '270', '267', '2', '2026-10-22 09:40:25','0','0'); -- id=16370
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1216', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 09:40:25', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=4920
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4920;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2819.7511252317, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2819.7511252317, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2819.7511252317, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2819.7511252317, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '464', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '470', '464', '2', '2026-10-22 09:40:25','0','0'); -- id=16371
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6915;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.6','02337', '1216', '115', '2337', '9', '455', '4095', '0', '', '0', '2026-10-22 09:40:25', '2337', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6915-9,','1','1','0','0','455','4095','0','','0','0.00','0','0','0','0'); -- id=4921
UPDATE sellbilldetail SET  lastbuyprice = 455.00 , meanbuyprice = 455.00, lastbuyprice_withDiscount = 418.60, meanbuyprice_withDiscount = 418.60
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 418.6
                where sellbilldetailid = 4921;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2337, '2026-10-22', 4094.6386020651, 4095, 4095
                    , 4095, 3767.4, 3767.4, 3767.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4095, 4095, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4094.6386020651, sellCostBuyPrice =sellCostBuyPrice+4095
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4095, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4095
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3767.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3767.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3767.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4095
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4095
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4094.6386020651, 4095, 4095
                    , 4095, 3767.4, 3767.4, 3767.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4095, 4095, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4094.6386020651, sellCostBuyPrice =sellCostBuyPrice+4095
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4095, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4095
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3767.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3767.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3767.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4095
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4095
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3731';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2337', '1', '9', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '2', '2026-10-22 09:40:25','0','0'); -- id=16372
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7046;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('478.4','02389', '1216', '149', '2389', '9', '520', '4680', '0', '', '0', '2026-10-22 09:40:25', '2389', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7046-9,','1','1','0','0','520','4680','0','','0','0.00','0','0','0','0'); -- id=4922
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 478.40, meanbuyprice_withDiscount = 478.40
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 478.4
                where sellbilldetailid = 4922;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2389, '2026-10-22', 4679.5869737887, 4680, 4680
                    , 4680, 4305.6, 4305.6, 4305.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4679.5869737887, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4305.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4305.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4305.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4679.5869737887, 4680, 4680
                    , 4680, 4305.6, 4305.6, 4305.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4679.5869737887, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4305.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4305.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4305.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '2', storedetaildate = '2026-10-22 09:40:25' WHERE storedetailid = '3784';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2389', '1', '9', '1', '1216', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '51', '2', '2026-10-22 09:40:25','0','0'); -- id=16373
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7605078.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7548428.5','56650', '0', '2', 'اضافة فاتورة مبيعات', '1216', '7605078.5', '2026-10-22 09:40:25', '2',  'sellbillController.php','1','','0'); -- id=1518
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '56655', '56655', '2026-10-22', '2', '0', '0', '2026-10-22 09:40:25','اضافة فاتورة مبيعات رقم 1216','1','0',null,'0','1216','sellbillController.php?do=showDetail&sellbillid=1216'); -- id=4310
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4310', '419', '56650', '','0'); -- id=4424
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7605078', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4310', '398', '5', '','0'); -- id=4425
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510299.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4310', '143', '56655', '','0'); -- id=4312
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13807970', 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 ( '53180', '53180', '2026-10-22', '2', '0', '0', '2026-10-22 09:40:25','اضافة فاتورة مبيعات رقم 1216 - صرف البضاعة من المخزن','1','0',null,'0','1216','sellbillController.php?do=showDetail&sellbillid=1216'); -- id=4311
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4311', '402', '53180', '','0'); -- id=4426
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12774164.21', 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 ('4311', '382', '53180', '','0'); -- id=4313
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26353477.29', 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='4310,0,4311' where sellbillid=1216;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 56650, 54164, 54164
                    , 54166.3, 53180, 53182.3, 53180
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,54164, 54166.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56650, sellCostBuyPrice =sellCostBuyPrice+54164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54164, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54166.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53182.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54166.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 56650, 54164, 54164
                    , 54166.3, 53180, 53182.3, 53180
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,54164, 54166.3, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+56650, sellCostBuyPrice =sellCostBuyPrice+54164
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+54164, sellCostMeanBuyPrice = sellCostMeanBuyPrice+54166.3
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53182.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+54164
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+54166.3
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 56650, 54164, 54164
                    , 54166.3, 53180, 53182.3, 53180, 54164, 54166.3)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+56650, netSellCostBuyPrice = netSellCostBuyPrice+54164
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+54164
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+54166.3
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+53180
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+53182.3
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+53180
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+54164
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+54166.3;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9a8680501f and sellbillId = 1216 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:40:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:40:25', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17548
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:10:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:40:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:40:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17549
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:11:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:41:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:41:30', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17550
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل نص سوسته ستيفو ','','141','350','350','0','0','2026-10-22','0','5','0','','0','0','0','0','0','350','350','350','350','350','0','0','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=2396
UPDATE product SET productName = 'موديل نص سوسته ستيفو ', productDescription = '', productCatId = '141', productBuyPrice = '350', productSellAllPrice = '350', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02396',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2396';
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', '2396', '1', '2026-10-22', '5', '0','0239601','350','0','0','350','','0','0','0','0','0','0','0','0','0','0'); -- id=2396
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2396', '1', '0', '5', '2026-10-22'); -- id=3791
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2396', '1', '0', '0', '2396', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16374
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2396, 1,'2026-10-22 09:41:30',5)
                ON DUPLICATE KEY UPDATE productid = 2396, edited = 1, sysdate = '2026-10-22 09:41:30', userid = 5; -- id=3571
UPDATE product SET productName = 'موديل نص سوسته ستيفو ', productDescription = '', productCatId = '141', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02396',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2396';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:11:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:41:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:41:31', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:11:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:41:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:41:33', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17552
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 09:42:25', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:42:31', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:42:43', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17555
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 ('06ad9b01d12e18', '2026-10-22 09:41:33', '92', '65455.00', '121750', '10', '1', '62550.00',  '56295.00', '0', '56295', '1', '2026-10-22 09:42:44', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=319
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 ('02396', '319', '141', '2396', '63', '350', '22050.00', '0', '', '2026-10-22 09:42:44', '2396','','','0','0','0','0','0',null,'350','22050','0','0','0','0','0','0','0','0','1'); -- id=1735
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:41:33', 1, 2396, 0, 0
                    , 315, 63, 0, 0, 5, '2026-10-22 09:42:44')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+63, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:42:44' ; -- id=7061
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2396', '350', '63', '0', 'buyBillController.php', '1735', '', '0', '0'); -- id=1281
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2396 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1735 ;
UPDATE product SET productName = 'موديل نص سوسته ستيفو ', productDescription = '', productCatId = '141', productBuyPrice = '350.00', productSellAllPrice = '350.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02396',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '315',meanbuyprice = '350',meanbuyprice_withDiscount = '315' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2396';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 315
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 1735;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2396;
UPDATE storedetail SET  productquantity = '63', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3791';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2396', '1', '63', '0', '319', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '63', '5', '2026-10-22 09:41:33','0','0'); -- id=16375
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 ('01839', '319', '141', '1839', '90', '450', '40500.00', '0', '', '2026-10-22 09:42:44', '1839','','','0','0','0','0','0',null,'450','40500','0','0','0','0','0','0','0','0','1'); -- id=1736
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:41:33', 1, 1839, 0, 0
                    , 405, 90, 0, 0, 5, '2026-10-22 09:42:44')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+90, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 09:42:44' ; -- id=7062
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1839', '450', '90', '0', 'buyBillController.php', '1736', '', '0', '0'); -- id=1282
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1839 ;
UPDATE buybilldetail SET  quantitybefore = 69 WHERE buybilldetailid = 1736 ;
UPDATE product SET productName = 'موديل كب شو ستيفو', productDescription = '', productCatId = '141', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-12', conditions = '0', userId = '1', limitamount = '0', parcode = '01839',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '414.76' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='352.36',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='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1839';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 414.76
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 352.36, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1736;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1839;
UPDATE storedetail SET  productquantity = '159', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '2854';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1839', '1', '90', '0', '319', 'اضافة فاتورة مشتريات', 'buyBillController.php', '69', '159', '5', '2026-10-22 09:41:33','0','0'); -- id=16376
UPDATE supplier SET  suppliercurrentDebt = '121750',suppliercurrentDebtInCurrency= '121750' , userid = '5', supplierdate = '2026-10-22 09:42:44'   WHERE supplierid = '92';
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 ('92', '65455.00', '56295', '0', 'اضافة فاتورة مشتريات', '319', '121750', '2026-10-22 09:41:33', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','56295','1','65455','56295','121750','0',''); -- id=865
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '56295', '56295', '2026-10-22', '5', '0', '0', '2026-10-22 09:42:44','اضافة فاتورة مشتريات رقم 319','1','0',null,'0','319','buyBillController.php?do=details&id=319'); -- id=4312
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4312', '382', '56295', '','0'); -- id=4427
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26409772.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4312', '575', '56295', '','0'); -- id=4314
UPDATE accountstree SET name = 'ستيفو-موردين', customName = 'ستيفو-موردين', customNameEn = 'ستيفو-موردين', nameEn = 'ستيفو-موردين', parent = '81', accountNature = '1', theValue = '188012', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 19:55:21' WHERE id = '575';
update buybill set dailyentryid='4312,0' where buybillid=319;
COMMIT;
UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1839;UPDATE product SET overAllAveragePrice = 315 WHERE productId = 2396;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:42:44', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=319'); -- id=17556
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:42:47', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=319&type=2'); -- id=17557
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:12:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:42:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:42:57', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:13:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:43:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:43:08', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:13:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:43:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:43:08', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:13:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:43:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:43:45', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17561
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:13:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:43:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:43:46', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17562
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:44:08', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17563
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 ('06ad9b07c5a10a', '2026-10-22 09:43:08', '55', '546030.00', '566280', '0', '0', '20250.00',  '20250.00', '0', '20250', '1', '2026-10-22 09:44:08', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=320
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 ('02260', '320', '199', '2260', '45', '450', '20250.00', '0', '', '2026-10-22 09:44:08', '2260','','','0','0','0','0','0',null,'450','20250','0','0','0','0','0','0','0','0','1'); -- id=1737
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 09:43:08', 1, 2260, 0, 0
                    , 450, 45, 0, 0, 7, '2026-10-22 09:44:08')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 09:44:08' ; -- id=7063
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2260', '450', '45', '0', 'buyBillController.php', '1737', '', '0', '0'); -- id=1283
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2260 ;
UPDATE buybilldetail SET  quantitybefore = 15 WHERE buybilldetailid = 1737 ;
UPDATE product SET productName = 'بوكس فيت مستر ام ', productDescription = '', productCatId = '199', productBuyPrice = '450.00', productSellAllPrice = '465.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-20', conditions = '0', userId = '5', limitamount = '0', parcode = '02260',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.33' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2260';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1737;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2260;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3651';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2260', '1', '45', '0', '320', 'اضافة فاتورة مشتريات', 'buyBillController.php', '15', '60', '7', '2026-10-22 09:43:08','0','0'); -- id=16377
UPDATE supplier SET  suppliercurrentDebt = '188950',suppliercurrentDebtInCurrency= '566280' , userid = '7', supplierdate = '2026-10-22 09:44:08'   WHERE supplierid = '55';
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 ('55', '168700.00', '20250', '0', 'اضافة فاتورة مشتريات', '320', '188950', '2026-10-22 09:43:08', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','20250','1','546030','20250','566280','0',''); -- id=866
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20250', '20250', '2026-10-22', '7', '0', '0', '2026-10-22 09:44:08','اضافة فاتورة مشتريات رقم 320','1','0',null,'0','320','buyBillController.php?do=details&id=320'); -- id=4313
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4313', '382', '20250', '','0'); -- id=4428
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26430022.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4313', '474', '20250', '','0'); -- id=4315
UPDATE accountstree SET name = 'مستر ام - مورد', customName = 'مستر ام - مورد', customNameEn = 'مستر ام - مورد', nameEn = 'مستر ام - مورد', parent = '81', accountNature = '1', theValue = '20250', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '474';
update buybill set dailyentryid='4313,0' where buybillid=320;
COMMIT;
UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2260;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:44:08', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=320'); -- id=17564
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:44:10', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17565
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:44:10', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17566
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:44:10', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:44:13', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=320&type=2'); -- id=17568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:44:18', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17569

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9af9b2fcc3
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9af9b2fcc3 and sellbillId = 1217 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:44:18', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17570
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:44:27', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:44:27', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17572
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:44:34', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=320&type=2'); -- id=17573
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:44:42', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=319'); -- id=17574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:46", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:44:46', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=319&type=2'); -- id=17575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:44:56', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17576
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:14:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:44:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:44:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:15:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:45:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:45:00', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=320'); -- id=17578
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:15:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:45:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:45:03', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17579
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:15:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:45:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:45:03', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=319&type=2'); -- id=17580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:15:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:45:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:45:29', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:15:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:45:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:45:29', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:16:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:46:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:46:24', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=319&type=2'); -- id=17583
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:16:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:46:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:46:26', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=319'); -- id=17584
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:16:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:46:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:46:26', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:16:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:46:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:46:26', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:47:13', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=17587
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:47:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17588
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:47:18', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=details&id=319'); -- id=17589
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:22", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 09:47:22', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=17590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:47:23', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:47:23', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:47:24', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17593
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:47:26', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17594
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:26";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:47:26', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:17:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:47:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:47:29', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17596
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:48:11', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:11", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:48:11', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:13", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:48:13', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17599

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9af4a722db
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9af4a722db and sellbillId = 1218 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b0c27b724
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 09:48:18', '06ad9b0c27b724', '1', '0.00', '0', '0', '1', '15165.00', '15165', '15165', '0', '1', '2026-10-22 09:48:18', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '31' ,'0','','','','','-1','0','0','0','0','0','15165','0','','0','0','15165','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1219
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1219', '0', '2026-10-22 09:48:19', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15165', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:48:18','0','0','',''); -- id=1447
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1219', '207', '2381', '12', '470', '5640', '0', '', '0', '2026-10-22 09:48:19', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-12,','1','1','0','0','470','5640','0','','0','0.00','0','0','0','0'); -- id=4926
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4926;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 5640, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5640, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5640, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5640, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '425', userid = '3', storedetaildate = '2026-10-22 09:48:19' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '12', '1', '1219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '437', '425', '3', '2026-10-22 09:48:19','0','0'); -- id=16381
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6875;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('522','02321', '1219', '8', '2321', '5', '550', '2750', '0', '', '0', '2026-10-22 09:48:19', '2321', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6875-5,','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=4927
UPDATE sellbilldetail SET  lastbuyprice = 522.00 , meanbuyprice = 522.00, lastbuyprice_withDiscount = 522.00, meanbuyprice_withDiscount = 522.00
        , lastbuyprice_withTax = 522, meanbuyprice_withTax = 522, lastbuyprice_withDiscountAndTax = 522
                where sellbilldetailid = 4927;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2321, '2026-10-22', 2750, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2750, 2610, 2610
                    , 2610, 2610, 2610, 2610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2610, 2610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-22 09:48:19' WHERE storedetailid = '3715';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2321', '1', '5', '1', '1219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '15', '3', '2026-10-22 09:48:19','0','0'); -- id=16382
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6878;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('517','02324', '1219', '8', '2324', '5', '545', '2725', '0', '', '0', '2026-10-22 09:48:19', '2324', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6878-5,','1','1','0','0','545','2725','0','','0','0.00','0','0','0','0'); -- id=4928
UPDATE sellbilldetail SET  lastbuyprice = 517.00 , meanbuyprice = 517.00, lastbuyprice_withDiscount = 517.00, meanbuyprice_withDiscount = 517.00
        , lastbuyprice_withTax = 517, meanbuyprice_withTax = 517, lastbuyprice_withDiscountAndTax = 517
                where sellbilldetailid = 4928;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2324, '2026-10-22', 2725, 2585, 2585
                    , 2585, 2585, 2585, 2585
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2585, 2585, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2725, sellCostBuyPrice =sellCostBuyPrice+2585
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2585, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2585
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2585, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2585
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2585
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2585
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2585
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2725, 2585, 2585
                    , 2585, 2585, 2585, 2585
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2585, 2585, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2725, sellCostBuyPrice =sellCostBuyPrice+2585
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2585, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2585
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2585, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2585
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2585
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2585
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2585
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-22 09:48:19' WHERE storedetailid = '3718';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2324', '1', '5', '1', '1219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '30', '3', '2026-10-22 09:48:19','0','0'); -- id=16383
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1219', '207', '2380', '9', '450', '4050', '0', '', '0', '2026-10-22 09:48:19', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=4929
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4929;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 4050, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4050, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '440', userid = '3', storedetaildate = '2026-10-22 09:48:19' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '9', '1', '1219', 'اضافة فاتورة مبيعات', 'sellbillController.php', '449', '440', '3', '2026-10-22 09:48:19','0','0'); -- id=16384
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7638333.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7623168.5','15165', '0', '2', 'اضافة فاتورة مبيعات', '1219', '7638333.5', '2026-10-22 09:48:19', '3',  'sellbillController.php','1','','0'); -- id=1521
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15165', '15165', '2026-10-22', '3', '0', '0', '2026-10-22 09:48:19','اضافة فاتورة مبيعات رقم 1219','1','0',null,'0','1219','sellbillController.php?do=showDetail&sellbillid=1219'); -- id=4318
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4318', '419', '15165', '','0'); -- id=4433
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7638333', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4318', '143', '15165', '','0'); -- id=4320
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13847625', 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 ( '14465', '14465', '2026-10-22', '3', '0', '0', '2026-10-22 09:48:19','اضافة فاتورة مبيعات رقم 1219 - صرف البضاعة من المخزن','1','0',null,'0','1219','sellbillController.php?do=showDetail&sellbillid=1219'); -- id=4319
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4319', '402', '14465', '','0'); -- id=4434
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12811939.21', 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 ('4319', '382', '14465', '','0'); -- id=4321
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26392247.29', 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='4318,0,4319' where sellbillid=1219;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15165, 14465, 14465
                    , 14465, 14465, 14465, 14465
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14465, 14465, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15165, sellCostBuyPrice =sellCostBuyPrice+14465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14465
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14465
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14465
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14465
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15165, 14465, 14465
                    , 14465, 14465, 14465, 14465
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14465, 14465, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15165, sellCostBuyPrice =sellCostBuyPrice+14465
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14465, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14465
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14465, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14465
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14465
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14465
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14465
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 15165, 14465, 14465
                    , 14465, 14465, 14465, 14465, 14465, 14465)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15165, netSellCostBuyPrice = netSellCostBuyPrice+14465
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14465
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14465
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14465
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14465
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14465
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14465
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14465;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b0c27b724 and sellbillId = 1219 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:48:19', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17602
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:39", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:48:39', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17603
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:48:53', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=show'); -- id=17604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:48:56', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17605
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:18:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:48:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:48:57', '7', 'sellandreturnreport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=sellandreturnreport'); -- id=17606
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:49:05', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:49:12', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:49:19', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17609
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 09:49:42', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17610
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellBillReportsController.php', '2026-10-22 09:49:51', '7', 'sellandreturnreport', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellBillReportsController.php?do=sellandreturnreport'); -- id=17611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:49:53', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:19:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:49:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 09:49:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:46";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:51:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:51:50', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17614
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:50";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 09:51:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:51:50', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:51:51", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:51:51', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17616

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b1add48b8
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b1add48b8 and sellbillId = 1220 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:51:51", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:51:51', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17617
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:21:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:51:53", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:51:53', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:22:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:52:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:52:12', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1202'); -- id=17619
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:22:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:52:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:52:16', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17620
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:22:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:52:21", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:52:21', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17621

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b1b346c2b
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b1b346c2b and sellbillId = 1221 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b2a0e73a2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 09:53:48', '06ad9b2a0e73a2', '1', '0.00', '0', '20', '1', '13770.00', '13750', '13750', '0', '2', '2026-10-22 09:53:48', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','13750','0','','0','0','13750','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1222
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1222', '0', '2026-10-22 09:53:48', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13750', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:53:48','0','0','',''); -- id=1450
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7041;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('725','02351', '1222', '103', '2351', '9', '750', '6750', '0', '', '0', '2026-10-22 09:53:48', '2351', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','7041-9,','1','1','0','0','750','6750','0','','0','0.00','0','0','0','0'); -- id=4932
UPDATE sellbilldetail SET  lastbuyprice = 725.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 725.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725, meanbuyprice_withTax = 725, lastbuyprice_withDiscountAndTax = 725
                where sellbilldetailid = 4932;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2351, '2026-10-22', 6740.1960784314, 6525, 6525
                    , 6525, 6525, 6525, 6525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6525, 6525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6740.1960784314, sellCostBuyPrice =sellCostBuyPrice+6525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 6740.1960784314, 6525, 6525
                    , 6525, 6525, 6525, 6525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6525, 6525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6740.1960784314, sellCostBuyPrice =sellCostBuyPrice+6525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '4', storedetaildate = '2026-10-22 09:53:48' WHERE storedetailid = '3783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2351', '2', '9', '1', '1222', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '4', '2026-10-22 09:53:48','0','0'); -- id=16387
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1222', '86', '1324', '12', '390', '4680', '0', '', '0', '2026-10-22 09:53:48', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=4933
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4933;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 4673.2026143791, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4673.2026143791, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4267.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 4673.2026143791, 4320, 4320
                    , 4267.56, 4320, 4267.56, 4262.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4267.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4673.2026143791, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4267.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4267.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4262.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4267.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '980', userid = '4', storedetaildate = '2026-10-22 09:53:48' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '12', '1', '1222', 'اضافة فاتورة مبيعات', 'sellbillController.php', '992', '980', '4', '2026-10-22 09:53:48','0','0'); -- id=16388
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '1222', '87', '1325', '6', '390', '2340', '0', '', '0', '2026-10-22 09:53:48', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=4934
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 4934;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-22', 2336.6013071895, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2336.6013071895, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2336.6013071895, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2336.6013071895, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '166', userid = '4', storedetaildate = '2026-10-22 09:53:48' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '6', '1', '1222', 'اضافة فاتورة مبيعات', 'sellbillController.php', '172', '166', '4', '2026-10-22 09:53:48','0','0'); -- id=16389
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1188802.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1175052.875','13750', '0', '3', 'اضافة فاتورة مبيعات', '1222', '1188802.875', '2026-10-22 09:53:48', '4',  'sellbillController.php','1','','0'); -- id=1524
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13770', '13770', '2026-10-22', '4', '0', '0', '2026-10-22 09:53:48','اضافة فاتورة مبيعات رقم 1222','1','0',null,'0','1222','sellbillController.php?do=showDetail&sellbillid=1222'); -- id=4324
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4324', '501', '13750', '','0'); -- id=4439
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1188802.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4324', '398', '20', '','0'); -- id=4440
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510319.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4324', '143', '13770', '','0'); -- id=4326
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13866375', 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 ( '12945', '12945', '2026-10-22', '4', '0', '0', '2026-10-22 09:53:48','اضافة فاتورة مبيعات رقم 1222 - صرف البضاعة من المخزن','1','0',null,'0','1222','sellbillController.php?do=showDetail&sellbillid=1222'); -- id=4325
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4325', '402', '12945', '','0'); -- id=4441
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12829501.81', 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 ('4325', '492', '12945', '','0'); -- id=4327
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1559699', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4324,0,4325' where sellbillid=1222;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 13750, 12945, 12945
                    , 12892.56, 12945, 12892.56, 12887.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12945, 12892.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13750, sellCostBuyPrice =sellCostBuyPrice+12945
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12945, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12892.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12892.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12887.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12945
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12892.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 13750, 12945, 12945
                    , 12892.56, 12945, 12892.56, 12887.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12945, 12892.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13750, sellCostBuyPrice =sellCostBuyPrice+12945
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12945, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12892.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12892.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12887.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12945
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12892.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 13750, 12945, 12945
                    , 12892.56, 12945, 12892.56, 12887.4, 12945, 12892.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13750, netSellCostBuyPrice = netSellCostBuyPrice+12945
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12945
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12892.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12945
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12892.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12887.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12945
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12892.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b2a0e73a2 and sellbillId = 1222 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:23:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:53:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:53:49', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17624
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:24:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:54:06", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:54:06', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1222'); -- id=17625
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:25:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:55:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:55:31', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17626
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:55:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 09:55:41', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17627
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:25:42";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 09:55:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 09:55:42', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:25:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:55:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:55:44', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:26:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:56:01", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:56:01', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17630

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9afd9c2f7c
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 09:56:01', '06ad9afd9c2f7c', '1', '0.00', '0', '0', '1', '7650.00', '7650', '7650', '0', '1', '2026-10-22 09:56:01', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '18' ,'0','','','','','-1','0','0','0','0','0','7650','0','','0','0','7650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1223
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1223', '0', '2026-10-22 09:56:01', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 09:56:01','0','0','',''); -- id=1451
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1223', '147', '2359', '6', '425', '2550', '0', '', '0', '2026-10-22 09:56:01', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-6,','1','1','0','0','425','2550','0','','0','0.00','0','0','0','0'); -- id=4935
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 4935;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 2550, 2364, 2364
                    , 2364, 2364, 2364, 2364
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2364, 2364, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2364
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2364, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2364
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2364, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2364
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2364
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2364
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2364
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2364, 2364
                    , 2364, 2364, 2364, 2364
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2364, 2364, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2364
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2364, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2364
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2364, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2364
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2364
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2364
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2364
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '66', userid = '2', storedetaildate = '2026-10-22 09:56:01' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '6', '1', '1223', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '66', '2', '2026-10-22 09:56:01','0','0'); -- id=16390
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 952;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01459', '1223', '103', '1459', '3', '330', '990', '0', '', '0', '2026-10-22 09:56:01', '1459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','952-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=4936
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 4936;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1459, '2026-10-22', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '49', userid = '2', storedetaildate = '2026-10-22 09:56:01' WHERE storedetailid = '1484';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1459', '1', '3', '1', '1223', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '49', '2', '2026-10-22 09:56:01','0','0'); -- id=16391
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1223', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 09:56:01', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=4937
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4937;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '437', userid = '2', storedetaildate = '2026-10-22 09:56:01' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1223', 'اضافة فاتورة مبيعات', 'sellbillController.php', '440', '437', '2', '2026-10-22 09:56:01','0','0'); -- id=16392
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1223', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 09:56:01', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=4938
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4938;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '422', userid = '2', storedetaildate = '2026-10-22 09:56:01' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1223', 'اضافة فاتورة مبيعات', 'sellbillController.php', '425', '422', '2', '2026-10-22 09:56:01','0','0'); -- id=16393
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1223', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 09:56:01', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=4939
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4939;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '434', userid = '2', storedetaildate = '2026-10-22 09:56:01' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1223', 'اضافة فاتورة مبيعات', 'sellbillController.php', '437', '434', '2', '2026-10-22 09:56:02','0','0'); -- id=16394
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7648263.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7640613.5','7650', '0', '2', 'اضافة فاتورة مبيعات', '1223', '7648263.5', '2026-10-22 09:56:02', '2',  'sellbillController.php','1','','0'); -- id=1525
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7650', '7650', '2026-10-22', '2', '0', '0', '2026-10-22 09:56:02','اضافة فاتورة مبيعات رقم 1223','1','0',null,'0','1223','sellbillController.php?do=showDetail&sellbillid=1223'); -- id=4326
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4326', '419', '7650', '','0'); -- id=4442
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7648263', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4326', '143', '7650', '','0'); -- id=4328
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13874025', 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 ( '7224', '7224', '2026-10-22', '2', '0', '0', '2026-10-22 09:56:02','اضافة فاتورة مبيعات رقم 1223 - صرف البضاعة من المخزن','1','0',null,'0','1223','sellbillController.php?do=showDetail&sellbillid=1223'); -- id=4327
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4327', '402', '7224', '','0'); -- id=4443
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12836725.81', 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 ('4327', '382', '7224', '','0'); -- id=4329
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26380405.69', 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='4326,0,4327' where sellbillid=1223;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 7650, 7224, 7224
                    , 7224, 7224, 7224, 7224
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7224, 7224, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7650, sellCostBuyPrice =sellCostBuyPrice+7224
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7224, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7224
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7224, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7224
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7224
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7224
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7224
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7650, 7224, 7224
                    , 7224, 7224, 7224, 7224
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7224, 7224, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7650, sellCostBuyPrice =sellCostBuyPrice+7224
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7224, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7224
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7224, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7224
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7224
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7224
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7224
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 7650, 7224, 7224
                    , 7224, 7224, 7224, 7224, 7224, 7224)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7650, netSellCostBuyPrice = netSellCostBuyPrice+7224
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7224
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7224
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7224
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7224
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7224
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7224
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7224;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9afd9c2f7c and sellbillId = 1223 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:26:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:56:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:56:02', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:26:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:56:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:56:13', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17632

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9afcba43eb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9afcba43eb and sellbillId = 1224 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:26:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:56:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:56:13', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17633
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:27:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:57:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:57:08', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17634

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b363461d6
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b363461d6 and sellbillId = 1225 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:27:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:57:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:57:09', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17635
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:27:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:57:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:57:31', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1225'); -- id=17636
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:27:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:57:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 09:57:50', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:27:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 09:57:56", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 09:57:56', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:31:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:01:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 10:01:16', '5', 'addprocat', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=addprocat'); -- id=17639
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:31:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:01:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:01:41', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17640
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:31:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:01:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:01:44', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:31:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:01:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:01:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:31:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:01:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:01:48', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:10", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:10', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17644
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:42', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17645

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b2a614191
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:02:42', '06ad9b2a614191', '1', '0.00', '0', '190', '1', '31590.00', '31400', '31400', '0', '1', '2026-10-22 10:02:42', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '70' ,'0','','','','','-1','0','0','0','0','0','31400','0','','0','0','31400','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1226
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1226', '0', '2026-10-22 10:02:42', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '31400', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:02:42','0','0','',''); -- id=1454
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6765;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1226', '147', '1886', '12', '320', '3840', '0', '', '0', '2026-10-22 10:02:42', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=4943
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 4943;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 3816.9040835708, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3816.9040835708, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3816.9040835708, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3816.9040835708, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '124', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '12', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '136', '124', '3', '2026-10-22 10:02:42','0','0'); -- id=16398
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6293;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02177', '1226', '190', '2177', '12', '335', '4020', '0', '', '0', '2026-10-22 10:02:42', '2177', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6293-12,','1','1','0','0','335','4020','0','','0','0.00','0','0','0','0'); -- id=4944
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 157.5, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 4944;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2177, '2026-10-22', 3995.8214624881, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3780, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3995.8214624881, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3995.8214624881, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 1890, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3995.8214624881, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1890
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '3537';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2177', '1', '12', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '24', '3', '2026-10-22 10:02:42','0','0'); -- id=16399
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6915;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.6','02337', '1226', '115', '2337', '12', '455', '5460', '0', '', '0', '2026-10-22 10:02:42', '2337', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6915-12,','1','1','0','0','455','5460','0','','0','0.00','0','0','0','0'); -- id=4945
UPDATE sellbilldetail SET  lastbuyprice = 455.00 , meanbuyprice = 455.00, lastbuyprice_withDiscount = 418.60, meanbuyprice_withDiscount = 418.60
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 418.6
                where sellbilldetailid = 4945;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2337, '2026-10-22', 5427.1604938272, 5460, 5460
                    , 5460, 5023.2, 5023.2, 5023.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5460, 5460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5427.1604938272, sellCostBuyPrice =sellCostBuyPrice+5460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5023.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5023.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5023.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5427.1604938272, 5460, 5460
                    , 5460, 5023.2, 5023.2, 5023.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5460, 5460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5427.1604938272, sellCostBuyPrice =sellCostBuyPrice+5460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5023.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5023.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5023.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '3731';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2337', '1', '12', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '9', '3', '2026-10-22 10:02:42','0','0'); -- id=16400
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6965;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','02348', '1226', '177', '2348', '12', '630', '7560', '0', '', '0', '2026-10-22 10:02:42', '2348', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6965-12,','1','1','0','0','630','7560','0','','0','0.00','0','0','0','0'); -- id=4946
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 4946;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2348, '2026-10-22', 7514.5299145299, 6960, 6960
                    , 6960, 6960, 6960, 6960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 6960, 6960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7514.5299145299, sellCostBuyPrice =sellCostBuyPrice+6960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7514.5299145299, 6960, 6960
                    , 6960, 6960, 6960, 6960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6960, 6960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7514.5299145299, sellCostBuyPrice =sellCostBuyPrice+6960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '3742';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2348', '1', '12', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '4', '3', '2026-10-22 10:02:42','0','0'); -- id=16401
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 1136;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('500','01948', '1226', '157', '1948', '4', '520', '2080', '0', '', '0', '2026-10-22 10:02:42', '1948', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1136-4,','1','1','0','0','520','2080','0','','0','0.00','0','0','0','0'); -- id=4947
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 500.00, meanbuyprice_withDiscount = 500.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 500
                where sellbilldetailid = 4947;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1948, '2026-10-22', 2067.4897119342, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2067.4897119342, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2067.4897119342, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2067.4897119342, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '93', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '2965';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1948', '1', '4', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '97', '93', '3', '2026-10-22 10:02:42','0','0'); -- id=16402
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6906;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('515.2','02334', '1226', '158', '2334', '4', '560', '2240', '0', '', '0', '2026-10-22 10:02:42', '2334', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6906-4,','1','1','0','0','560','2240','0','','0','0.00','0','0','0','0'); -- id=4948
UPDATE sellbilldetail SET  lastbuyprice = 560.00 , meanbuyprice = 560.00, lastbuyprice_withDiscount = 515.20, meanbuyprice_withDiscount = 515.20
        , lastbuyprice_withTax = 560, meanbuyprice_withTax = 560, lastbuyprice_withDiscountAndTax = 515.2
                where sellbilldetailid = 4948;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2334, '2026-10-22', 2226.5273820829, 2240, 2240
                    , 2240, 2060.8, 2060.8, 2060.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2240, 2240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2226.5273820829, sellCostBuyPrice =sellCostBuyPrice+2240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2060.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2060.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2060.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2226.5273820829, 2240, 2240
                    , 2240, 2060.8, 2060.8, 2060.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2240, 2240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2226.5273820829, sellCostBuyPrice =sellCostBuyPrice+2240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2060.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2060.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2060.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '3728';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2334', '1', '4', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28', '24', '3', '2026-10-22 10:02:42','0','0'); -- id=16403
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 1062;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('525','01911', '1226', '143', '1911', '6', '585', '3510', '0', '', '0', '2026-10-22 10:02:42', '1911', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1062-6,','1','1','0','0','585','3510','0','','0','0.00','0','0','0','0'); -- id=4949
UPDATE sellbilldetail SET  lastbuyprice = 525.00 , meanbuyprice = 525.00, lastbuyprice_withDiscount = 525.00, meanbuyprice_withDiscount = 525.00
        , lastbuyprice_withTax = 525, meanbuyprice_withTax = 672.66, lastbuyprice_withDiscountAndTax = 525
                where sellbilldetailid = 4949;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1911, '2026-10-22', 3488.8888888889, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3150, 4035.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3488.8888888889, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4035.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3488.8888888889, 3150, 3150
                    , 3150, 3150, 3150, 3150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 4035.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3488.8888888889, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4035.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '2928';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1911', '1', '6', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '3', '2026-10-22 10:02:42','0','0'); -- id=16404
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 735;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','i0001777', '1226', '99', '1777', '8', '360', '2880', '0', '', '0', '2026-10-22 10:02:42', '1777', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','735-8,','1','1','0','0','360','2880','0','','0','0.00','0','0','0','0'); -- id=4950
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 324.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 4950;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1777, '2026-10-22', 2862.6780626781, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2862.6780626781, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2862.6780626781, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2862.6780626781, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '3', storedetaildate = '2026-10-22 10:02:42' WHERE storedetailid = '2790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1777', '1', '8', '1', '1226', 'اضافة فاتورة مبيعات', 'sellbillController.php', '32', '24', '3', '2026-10-22 10:02:42','0','0'); -- id=16405
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7686338.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7654938.5','31400', '0', '2', 'اضافة فاتورة مبيعات', '1226', '7686338.5', '2026-10-22 10:02:42', '3',  'sellbillController.php','1','','0'); -- id=1528
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '31590', '31590', '2026-10-22', '3', '0', '0', '2026-10-22 10:02:42','اضافة فاتورة مبيعات رقم 1226','1','0',null,'0','1226','sellbillController.php?do=showDetail&sellbillid=1226'); -- id=4332
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4332', '419', '31400', '','0'); -- id=4448
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7686338', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4332', '398', '190', '','0'); -- id=4449
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510509.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4332', '143', '31590', '','0'); -- id=4334
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13916770', 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 ( '29034', '29034', '2026-10-22', '3', '0', '0', '2026-10-22 10:02:42','اضافة فاتورة مبيعات رقم 1226 - صرف البضاعة من المخزن','1','0',null,'0','1226','sellbillController.php?do=showDetail&sellbillid=1226'); -- id=4333
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4333', '402', '29034', '','0'); -- id=4450
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12876101.81', 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 ('4333', '382', '29034', '','0'); -- id=4335
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26345029.69', 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='4332,0,4333' where sellbillid=1226;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 31400, 29938, 29938
                    , 29938, 29034, 29034, 29034
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29938, 28933.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31400, sellCostBuyPrice =sellCostBuyPrice+29938
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29938, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29938
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29034, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29034
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29034
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29938
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28933.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 31400, 29938, 29938
                    , 29938, 29034, 29034, 29034
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29938, 28933.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+31400, sellCostBuyPrice =sellCostBuyPrice+29938
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29938, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29938
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+29034, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+29034
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+29034
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29938
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28933.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 31400, 29938, 29938
                    , 29938, 29034, 29034, 29034, 29938, 28933.96)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+31400, netSellCostBuyPrice = netSellCostBuyPrice+29938
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+29938
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+29938
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+29034
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+29034
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+29034
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+29938
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+28933.96;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b2a614191 and sellbillId = 1226 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:42', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:51', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1226'); -- id=17647
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:52', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1226'); -- id=17648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:58', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:32:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:02:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:02:58', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:33:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:03:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:03:52', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17651

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b4f2b6f14
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b4f2b6f14 and sellbillId = 1227 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:33:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:03:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:03:52', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1226'); -- id=17652
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:33:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:03:52", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:03:52', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17653
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:33:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:03:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:03:52', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1226'); -- id=17654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:36:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:06:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:06:24', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17655
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:37:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:07:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:07:26', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17656
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:37:26";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:07:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:07:26', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17657
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:37:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:07:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:07:27', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17658
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:37:27";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:07:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:07:27', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:37:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:07:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:07:29', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:38:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:08:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:08:05', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17661
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:38:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:08:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:08:53', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17662
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:09:02', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17663
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:09:19', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:09:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:09:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:09:52', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17667
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('الديب استراس 2017 ميلانو','','37','550','570','0','0','2026-10-22','0','7','0','','0','0','0','0','0','550','550','550','550','550','0','3.64','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=2397
UPDATE product SET productName = 'الديب استراس 2017 ميلانو', productDescription = '', productCatId = '37', productBuyPrice = '550', productSellAllPrice = '570', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02397',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '3.64' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2397';
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', '2397', '1', '2026-10-22', '7', '0','0239701','570','0','0','550','','0','0','0','0','0','0','0','0','0','0'); -- id=2397
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2397', '1', '15', '7', '2026-10-22'); -- id=3792
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2397', '1', '15', '0', '2397', 'إضافة منتج', 'productController.php', '0', '15', '7', '2026-10-22','0','0'); -- id=16407
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2397, 1,'2026-10-22 10:09:52',7)
                ON DUPLICATE KEY UPDATE productid = 2397, edited = 1, sysdate = '2026-10-22 10:09:52', userid = 7; -- id=3572
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8250', '8250', '2026-10-22', '7', '0', '0', '2026-10-22 10:09:52','إضافة منتج الديب استراس 2017 ميلانو الكمية 15','1','0','-1','0','2397','productController.php?do=edit&id=2397'); -- id=4336
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4336', '382', '8250', '','0'); -- id=4453
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26344079.69', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4336', '121', '8250', '','0'); -- id=4338
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '10629304.65', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'الديب استراس 2017 ميلانو', productDescription = '', productCatId = '37', productBuyPrice = '550.00', productSellAllPrice = '570.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02397',type ='0', expireDate = '0' , dailyentryId = '4336',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '3.64' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2397';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:09:53', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:39:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:09:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:09:55', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:40:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:10:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:10:15', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17670
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:41:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:11:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:11:20', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17671
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:41:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:11:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:11:21', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17672
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:41:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:11:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:11:23', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17673
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:00", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:00', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17674

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b287e383a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:12:00', '06ad9b287e383a', '1', '0.00', '0', '0', '1', '22875.00', '22875', '22875', '0', '1', '2026-10-22 10:12:00', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '33' ,'0','','','','','-1','0','0','0','0','0','22875','0','','0','0','22875','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1228
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1228', '0', '2026-10-22 10:12:00', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '22875', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:12:00','0','0','',''); -- id=1456
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 228;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01453', '1228', '192', '1453', '9', '850', '7650', '0', '', '0', '2026-10-22 10:12:00', '1453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','228-9,','1','1','0','0','850','7650','0','','0','0.00','0','0','0','0'); -- id=4952
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        
                where sellbilldetailid = 4952;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1453, '2026-10-22', 7650, 7200, 7200
                    , 7200, 7200, 7200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7650, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7650, 7200, 7200
                    , 7200, 7200, 7200, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7650, sellCostBuyPrice =sellCostBuyPrice+7200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '126', userid = '6', storedetaildate = '2026-10-22 10:12:00' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1453', '1', '9', '1', '1228', 'اضافة فاتورة مبيعات', 'sellbillController.php', '135', '126', '6', '2026-10-22 10:12:00','0','0'); -- id=16408
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1228', '175', '2088', '15', '595', '8925', '0', '', '0', '2026-10-22 10:12:00', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-15,','1','1','0','0','595','8925','0','','0','0.00','0','0','0','0'); -- id=4953
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4953;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 8925, 6900, 6900
                    , 6900, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 6900, 6900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8925, sellCostBuyPrice =sellCostBuyPrice+6900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8925, 6900, 6900
                    , 6900, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6900, 6900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8925, sellCostBuyPrice =sellCostBuyPrice+6900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1036', userid = '6', storedetaildate = '2026-10-22 10:12:00' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '15', '1', '1228', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1051', '1036', '6', '2026-10-22 10:12:00','0','0'); -- id=16409
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6821;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('660','02306', '1228', '203', '2306', '9', '700', '6300', '0', '', '0', '2026-10-22 10:12:00', '2306', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6821-9,','1','1','0','0','700','6300','0','','0','0.00','0','0','0','0'); -- id=4954
UPDATE sellbilldetail SET  lastbuyprice = 660.00 , meanbuyprice = 660.00, lastbuyprice_withDiscount = 660.00, meanbuyprice_withDiscount = 660.00
        , lastbuyprice_withTax = 660, meanbuyprice_withTax = 660, lastbuyprice_withDiscountAndTax = 660
                where sellbilldetailid = 4954;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2306, '2026-10-22', 6300, 5940, 5940
                    , 5940, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 5940, 5940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6300, sellCostBuyPrice =sellCostBuyPrice+5940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6300, 5940, 5940
                    , 5940, 5940, 5940, 5940
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5940, 5940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6300, sellCostBuyPrice =sellCostBuyPrice+5940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5940, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5940
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5940
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '6', storedetaildate = '2026-10-22 10:12:00' WHERE storedetailid = '3699';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2306', '1', '9', '1', '1228', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '9', '6', '2026-10-22 10:12:00','0','0'); -- id=16410
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1097325',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1074450','22875', '0', '4', 'اضافة فاتورة مبيعات', '1228', '1097325', '2026-10-22 10:12:00', '6',  'sellbillController.php','1','','0'); -- id=1530
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22875', '22875', '2026-10-22', '6', '0', '0', '2026-10-22 10:12:00','اضافة فاتورة مبيعات رقم 1228','1','0',null,'0','1228','sellbillController.php?do=showDetail&sellbillid=1228'); -- id=4337
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4337', '568', '22875', '','0'); -- id=4454
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1097325', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4337', '143', '22875', '','0'); -- id=4339
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13951545', 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 ( '20040', '20040', '2026-10-22', '6', '0', '0', '2026-10-22 10:12:00','اضافة فاتورة مبيعات رقم 1228 - صرف البضاعة من المخزن','1','0',null,'0','1228','sellbillController.php?do=showDetail&sellbillid=1228'); -- id=4338
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4338', '402', '20040', '','0'); -- id=4455
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12905341.81', 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 ('4338', '382', '20040', '','0'); -- id=4340
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26324039.69', 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='4337,0,4338' where sellbillid=1228;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 22875, 20040, 20040
                    , 20040, 20040, 20040, 12840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12840, 12840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22875, sellCostBuyPrice =sellCostBuyPrice+20040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 22875, 20040, 20040
                    , 20040, 20040, 20040, 12840
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12840, 12840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22875, sellCostBuyPrice =sellCostBuyPrice+20040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 22875, 20040, 20040
                    , 20040, 20040, 20040, 12840, 12840, 12840)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+22875, netSellCostBuyPrice = netSellCostBuyPrice+20040
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+20040
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+20040
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20040
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20040
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12840
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12840
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12840;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b287e383a and sellbillId = 1228 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:00", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:00', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17675
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:12:23', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17676
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:23";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:12:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:12:23', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:25', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17678
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:25', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:25', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:31', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17681

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b6c00a952
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:12:31', '06ad9b6c00a952', '1', '0.00', '0', '0', '1', '7760.00', '7760', '7760', '0', '1', '2026-10-22 10:12:31', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '16' ,'0','','','','','-1','0','0','0','0','0','7760','0','','0','0','7760','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1229
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1229', '0', '2026-10-22 10:12:31', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7760', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:12:31','0','0','',''); -- id=1457
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 999;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01905', '1229', '149', '1905', '3', '480', '1440', '0', '', '0', '2026-10-22 10:12:31', '1905', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','999-3,','1','1','0','0','480','1440','0','','0','0.00','0','0','0','0'); -- id=4955
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 460.80
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 4955;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1905, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1382.4, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1382.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1382.4, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1382.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '3', storedetaildate = '2026-10-22 10:12:31' WHERE storedetailid = '2922';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1905', '1', '3', '1', '1229', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '9', '3', '2026-10-22 10:12:31','0','0'); -- id=16411
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6639;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02238', '1229', '114', '2238', '4', '500', '2000', '0', '', '0', '2026-10-22 10:12:31', '2238', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6639-4,','1','1','0','0','500','2000','0','','0','0.00','0','0','0','0'); -- id=4956
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4956;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2238, '2026-10-22', 2000, 2000, 2000
                    , 2000, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2000, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2000, 2000, 2000
                    , 2000, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2000, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '3', storedetaildate = '2026-10-22 10:12:31' WHERE storedetailid = '3629';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2238', '1', '4', '1', '1229', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '20', '3', '2026-10-22 10:12:31','0','0'); -- id=16412
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7052;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','02392', '1229', '209', '2392', '3', '480', '1440', '0', '', '0', '2026-10-22 10:12:31', '2392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7052-3,','1','1','0','0','480','1440','0','','0','0.00','0','0','0','0'); -- id=4957
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 441.60
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 4957;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2392, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1324.8, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1324.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1324.8, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1324.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '3', storedetaildate = '2026-10-22 10:12:31' WHERE storedetailid = '3787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2392', '1', '3', '1', '1229', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '57', '3', '2026-10-22 10:12:31','0','0'); -- id=16413
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6093;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02060', '1229', '108', '2060', '6', '480', '2880', '0', '', '0', '2026-10-22 10:12:31', '2060', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6093-6,','1','1','0','0','480','2880','0','','0','0.00','0','0','0','0'); -- id=4958
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4958;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2060, '2026-10-22', 2880, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '3', storedetaildate = '2026-10-22 10:12:31' WHERE storedetailid = '3419';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2060', '1', '6', '1', '1229', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '3', '2026-10-22 10:12:31','0','0'); -- id=16414
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7694098.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7686338.5','7760', '0', '2', 'اضافة فاتورة مبيعات', '1229', '7694098.5', '2026-10-22 10:12:31', '3',  'sellbillController.php','1','','0'); -- id=1531
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7760', '7760', '2026-10-22', '3', '0', '0', '2026-10-22 10:12:31','اضافة فاتورة مبيعات رقم 1229','1','0',null,'0','1229','sellbillController.php?do=showDetail&sellbillid=1229'); -- id=4339
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4339', '419', '7760', '','0'); -- id=4456
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7694098', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4339', '143', '7760', '','0'); -- id=4341
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13959305', 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 ( '7209.6', '7209.6', '2026-10-22', '3', '0', '0', '2026-10-22 10:12:31','اضافة فاتورة مبيعات رقم 1229 - صرف البضاعة من المخزن','1','0',null,'0','1229','sellbillController.php?do=showDetail&sellbillid=1229'); -- id=4340
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4340', '402', '7209.6', '','0'); -- id=4457
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12912551.41', 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 ('4340', '382', '7209.6', '','0'); -- id=4342
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26316830.09', 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='4339,0,4340' where sellbillid=1229;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 7760, 7640, 7640
                    , 7640, 7209.6, 7267.2, 7209.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7640, 6920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7760, sellCostBuyPrice =sellCostBuyPrice+7640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7209.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7267.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7209.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7760, 7640, 7640
                    , 7640, 7209.6, 7267.2, 7209.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7640, 6920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7760, sellCostBuyPrice =sellCostBuyPrice+7640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7209.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7267.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7209.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 7760, 7640, 7640
                    , 7640, 7209.6, 7267.2, 7209.6, 7640, 6920)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7760, netSellCostBuyPrice = netSellCostBuyPrice+7640
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7640
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7640
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7209.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7267.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7209.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7640
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6920;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b6c00a952 and sellbillId = 1229 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:12:31', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17682
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:42:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:12:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 10:12:38', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=17683
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:13:00', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17684
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:00";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:13:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:13:00', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:13:02', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17686
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 10:13:07', '5', 'autosave', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=17687
UPDATE storedetail SET  productquantity = '5', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '875';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('875', '1', '5', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0', '5', '5', '2026-10-22','0','0'); -- id=16415
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1700', '1700', '2026-10-22', '5', '0', '0', '2026-10-22 10:13:07','اعادة جرد للمنتج : (وايد ليج تقطيع جل زاي وان/زاي وان) فى مخزن : (المخزن الرئيسي) بالكمية : 5','1','0',null,'0','16415','inventoryController.php?do=details&id=16415'); -- id=4341
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4341', '382', '1700', '','0'); -- id=4458
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26318530.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4341', '188', '1700', '','0'); -- id=4343
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3243610', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:08", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:13:08', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17688

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b38d58eaf
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:13:08', '06ad9b38d58eaf', '1', '0.00', '0', '0', '1', '34290.00', '34290', '34290', '0', '1', '2026-10-22 10:13:08', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '94' ,'0','','','','','-1','0','0','0','0','0','34290','0','','0','0','34290','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1230
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1230', '0', '2026-10-22 10:13:08', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '34290', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:13:08','0','0','',''); -- id=1458
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('340','06446', '1230', '24', '875', '5', '360', '1800', '0', '', '0', '2026-10-22 10:13:08', '875', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','360','1800','0','','0','0.00','0','0','0','0'); -- id=4959
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 340.00, meanbuyprice_withDiscount = 340.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 340
                where sellbilldetailid = 4959;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (875, '2026-10-22', 1800, 1700, 1700
                    , 1700, 1700, 1700, 1700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1700, 1700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1800, 1700, 1700
                    , 1700, 1700, 1700, 1700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1700, 1700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '875';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('875', '1', '5', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '2', '2026-10-22 10:13:08','0','0'); -- id=16416
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 6647;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('345','09632', '1230', '24', '885', '20', '375', '7500', '0', '', '0', '2026-10-22 10:13:08', '885', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6647-20,','1','1','0','0','375','7500','0','','0','0.00','0','0','0','0'); -- id=4960
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 345.00, meanbuyprice_withDiscount = 345.00
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 345
                where sellbilldetailid = 4960;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (885, '2026-10-22', 7500, 7500, 7500
                    , 7500, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 7500, 7500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7500, sellCostBuyPrice =sellCostBuyPrice+7500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7500, 7500, 7500
                    , 7500, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7500, 7500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7500, sellCostBuyPrice =sellCostBuyPrice+7500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '46', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '885';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('885', '1', '20', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '46', '2', '2026-10-22 10:13:08','0','0'); -- id=16417
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','09633', '1230', '24', '886', '5', '380', '1900', '0', '', '0', '2026-10-22 10:13:08', '886', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','380','1900','0','','0','0.00','0','0','0','0'); -- id=4961
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4961;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (886, '2026-10-22', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1900, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1900, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '886';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('886', '1', '5', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '2', '2026-10-22 10:13:08','0','0'); -- id=16418
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','09369', '1230', '2', '1008', '10', '400', '4000', '0', '', '0', '2026-10-22 10:13:08', '1008', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','400','4000','0','','0','0.00','0','0','0','0'); -- id=4962
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 4962;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1008, '2026-10-22', 4000, 3800, 3800
                    , 3800, 3800, 3800, 3800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3800, 3800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4000, 3800, 3800
                    , 3800, 3800, 3800, 3800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3800, 3800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '1008';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1008', '1', '10', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '0', '2', '2026-10-22 10:13:08','0','0'); -- id=16419
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1230', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 10:13:08', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=4963
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4963;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '419', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '422', '419', '2', '2026-10-22 10:13:08','0','0'); -- id=16420
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6755;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312.8','02271', '1230', '71', '2271', '12', '340', '4080', '0', '', '0', '2026-10-22 10:13:08', '2271', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6755-12,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=4964
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 312.80, meanbuyprice_withDiscount = 312.80
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 312.8
                where sellbilldetailid = 4964;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2271, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '3664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2271', '1', '12', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '114', '2', '2026-10-22 10:13:08','0','0'); -- id=16421
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6758;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('331.2','02273', '1230', '71', '2273', '8', '360', '2880', '0', '', '0', '2026-10-22 10:13:08', '2273', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6758-8,','1','1','0','0','360','2880','0','','0','0.00','0','0','0','0'); -- id=4965
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 331.20, meanbuyprice_withDiscount = 331.20
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 331.2
                where sellbilldetailid = 4965;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2273, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '3666';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2273', '1', '8', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64', '56', '2', '2026-10-22 10:13:08','0','0'); -- id=16422
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 6755;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312.8','02271', '1230', '71', '2271', '16', '340', '5440', '0', '', '0', '2026-10-22 10:13:08', '2271', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6755-16,','1','1','0','0','340','5440','0','','0','0.00','0','0','0','0'); -- id=4966
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 312.80, meanbuyprice_withDiscount = 312.80
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 312.8
                where sellbilldetailid = 4966;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2271, '2026-10-22', 5440, 5440, 5440
                    , 5440, 5004.8, 5004.8, 5004.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 5440, 5440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+5440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5004.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5004.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5004.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5440, 5440, 5440
                    , 5440, 5004.8, 5004.8, 5004.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5440, 5440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5440, sellCostBuyPrice =sellCostBuyPrice+5440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5004.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5004.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5004.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '98', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '3664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2271', '1', '16', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '98', '2', '2026-10-22 10:13:08','0','0'); -- id=16423
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7053;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','02393', '1230', '189', '2393', '9', '360', '3240', '0', '', '0', '2026-10-22 10:13:08', '2393', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7053-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=4967
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 4967;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2393, '2026-10-22', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3240, 3240, 3240
                    , 3240, 3013.2, 3013.2, 3013.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3240, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3013.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3013.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3013.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '3788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2393', '1', '9', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '24', '2', '2026-10-22 10:13:08','0','0'); -- id=16424
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 467;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('330','01624', '1230', '32', '1624', '6', '350', '2100', '0', '', '0', '2026-10-22 10:13:08', '1624', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','467-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=4968
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 165, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 4968;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1624, '2026-10-22', 2100, 1980, 1980
                    , 1980, 1980, 1980, 1980
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1980, 990, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1980
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1980
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1980
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+990
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 1980, 1980
                    , 1980, 1980, 1980, 1980
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1980, 990, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1980
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1980
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1980
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+990
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 10:13:08' WHERE storedetailid = '1649';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1624', '1', '6', '1', '1230', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 10:13:08','0','0'); -- id=16425
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7728388.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7694098.5','34290', '0', '2', 'اضافة فاتورة مبيعات', '1230', '7728388.5', '2026-10-22 10:13:08', '2',  'sellbillController.php','1','','0'); -- id=1532
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '34290', '34290', '2026-10-22', '2', '0', '0', '2026-10-22 10:13:08','اضافة فاتورة مبيعات رقم 1230','1','0',null,'0','1230','sellbillController.php?do=showDetail&sellbillid=1230'); -- id=4342
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4342', '419', '34290', '','0'); -- id=4459
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7728388', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4342', '143', '34290', '','0'); -- id=4344
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '13993595', 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 ( '31891.2', '31891.2', '2026-10-22', '2', '0', '0', '2026-10-22 10:13:08','اضافة فاتورة مبيعات رقم 1230 - صرف البضاعة من المخزن','1','0',null,'0','1230','sellbillController.php?do=showDetail&sellbillid=1230'); -- id=4343
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4343', '402', '31891.2', '','0'); -- id=4460
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12944442.61', 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 ('4343', '382', '31891.2', '','0'); -- id=4345
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26286638.89', 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='4342,0,4343' where sellbillid=1230;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 34290, 33710, 33710
                    , 33710, 31891.2, 31891.2, 31891.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,33710, 32720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34290, sellCostBuyPrice =sellCostBuyPrice+33710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+31891.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+31891.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+31891.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33710
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 34290, 33710, 33710
                    , 33710, 31891.2, 31891.2, 31891.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,33710, 32720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+34290, sellCostBuyPrice =sellCostBuyPrice+33710
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+33710, sellCostMeanBuyPrice = sellCostMeanBuyPrice+33710
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+31891.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+31891.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+31891.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+33710
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+32720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 34290, 33710, 33710
                    , 33710, 31891.2, 31891.2, 31891.2, 33710, 32720)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+34290, netSellCostBuyPrice = netSellCostBuyPrice+33710
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+33710
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+33710
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+31891.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+31891.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+31891.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+33710
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+32720;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b38d58eaf and sellbillId = 1230 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:13:09', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17689
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 10:13:28', '5', 'autosave', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=17690
UPDATE storedetail SET  productquantity = '5', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '875';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('875', '1', '5', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0', '5', '5', '2026-10-22','0','0'); -- id=16426
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1700', '1700', '2026-10-22', '5', '0', '0', '2026-10-22 10:13:28','اعادة جرد للمنتج : (وايد ليج تقطيع جل زاي وان/زاي وان) فى مخزن : (المخزن الرئيسي) بالكمية : 5','1','0',null,'0','16426','inventoryController.php?do=details&id=16426'); -- id=4344
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4344', '382', '1700', '','0'); -- id=4461
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26288338.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4344', '188', '1700', '','0'); -- id=4346
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3245310', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:54";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:13:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:13:58', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17691
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:43:58";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:13:58', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17692
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:44:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:14:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:14:49', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17693
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:45:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:15:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:15:01', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17694
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:45:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:15:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:15:04', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:45:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:15:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:15:14', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:46:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:16:36", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:16:36', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17697

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b740b60fc
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b740b60fc and sellbillId = 1231 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:46:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:16:37", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:16:37', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17698
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:46:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:16:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:16:52', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17699
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 5127 فور ماكس','','161','700','750','0','0','2026-10-22','0','5','0','','0','0','0','0','0','700','700','700','700','700','0','7.14','0','0','.','0','0','0','700','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','700','700','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','700','0','0','0','0','0','0','','','0','0','0','0'); -- id=2398
UPDATE product SET productName = 'موديل 5127 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '700', productSellAllPrice = '750', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02398',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700' , buypricereal_precentage = '0' , buytotal_precentage = '7.14' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',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='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2398';
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', '2398', '1.00', '2026-10-22', '5', '0','0239801','750','0','0','700','','0','0','0','0','0','0','0','0','0','0'); -- id=2398
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2398', '1', '0', '5', '2026-10-22'); -- id=3793
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2398', '1', '0', '0', '2398', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16428
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2398, 1,'2026-10-22 10:16:52',5)
                ON DUPLICATE KEY UPDATE productid = 2398, edited = 1, sysdate = '2026-10-22 10:16:52', userid = 5; -- id=3573
UPDATE product SET productName = 'موديل 5127 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '700.00', productSellAllPrice = '750.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02398',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700' , buypricereal_precentage = '0' , buytotal_precentage = '7.14' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',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='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2398';
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 ('موديل 5115 فور ماكس','','161','1080','1150','0','0','2026-10-22','0','5','0','','0','0','0','0','0','1080','1080','1080','1080','1080','0','6.48','0','0','.','0','0','0','1080','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','1080','1080','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','1080','0','0','0','0','0','0','','','0','0','0','0'); -- id=2399
UPDATE product SET productName = 'موديل 5115 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '1080', productSellAllPrice = '1150', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02399',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1080',lastbuyprice_withDiscount = '1080',meanbuyprice = '1080',meanbuyprice_withDiscount = '1080' , productbuypricereal = '1080' , buypricereal_precentage = '0' , buytotal_precentage = '6.48' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1080',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='1080',meanbuyprice_withTax='1080',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1080',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2399';
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', '2399', '1.00', '2026-10-22', '5', '0','0239901','1150','0','0','1080','','0','0','0','0','0','0','0','0','0','0'); -- id=2399
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2399', '1', '0', '5', '2026-10-22'); -- id=3794
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2399', '1', '0', '0', '2399', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16429
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2399, 1,'2026-10-22 10:16:52',5)
                ON DUPLICATE KEY UPDATE productid = 2399, edited = 1, sysdate = '2026-10-22 10:16:52', userid = 5; -- id=3574
UPDATE product SET productName = 'موديل 5115 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '1080.00', productSellAllPrice = '1150.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02399',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1080',lastbuyprice_withDiscount = '1080',meanbuyprice = '1080',meanbuyprice_withDiscount = '1080' , productbuypricereal = '1080' , buypricereal_precentage = '0' , buytotal_precentage = '6.48' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1080',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='1080',meanbuyprice_withTax='1080',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1080',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2399';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:46:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:16:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:16:54', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17700
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:46:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:16:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:16:57', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:47:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:17:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:17:32', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17702

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b75fae475
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b75fae475 and sellbillId = 1232 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:47:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:17:33", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:17:33', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17703
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:47:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:17:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:17:50', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17704
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 ('06ad9b86919009', '2026-10-22 10:16:57', '174', '196100.00', '249500', '0', '0', '53400.00',  '53400.00', '0', '53400', '1', '2026-10-22 10:17:50', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=321
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 ('02398', '321', '161', '2398', '30', '700', '21000.00', '0', '', '2026-10-22 10:17:50', '2398','','','0','0','0','0','0',null,'700','21000','0','0','0','0','0','0','0','0','1'); -- id=1738
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:16:57', 1, 2398, 0, 0
                    , 700, 30, 0, 0, 5, '2026-10-22 10:17:50')
                ON DUPLICATE KEY UPDATE buyprice = 700,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:17:50' ; -- id=7064
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2398', '700', '30', '0', 'buyBillController.php', '1738', '', '0', '0'); -- id=1284
UPDATE product SET  productBuyPrice = "700" WHERE productId = 2398 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1738 ;
UPDATE product SET productName = 'موديل 5127 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '700.00', productSellAllPrice = '750.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02398',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.14' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',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='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2398';
UPDATE buybilldetail SET  lastbuyprice = 700 , meanbuyprice = 700, lastbuyprice_withDiscount = 700, meanbuyprice_withDiscount = 700
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 700, lastbuyprice_withDiscountAndTax = 700
                where buybilldetailid = 1738;
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 2398;
UPDATE storedetail SET  productquantity = '30', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3793';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2398', '1', '30', '0', '321', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '5', '2026-10-22 10:16:57','0','0'); -- id=16431
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 ('02399', '321', '161', '2399', '30', '1080', '32400.00', '0', '', '2026-10-22 10:17:50', '2399','','','0','0','0','0','0',null,'1080','32400','0','0','0','0','0','0','0','0','1'); -- id=1739
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:16:57', 1, 2399, 0, 0
                    , 1080, 30, 0, 0, 5, '2026-10-22 10:17:50')
                ON DUPLICATE KEY UPDATE buyprice = 1080,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:17:50' ; -- id=7065
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2399', '1080', '30', '0', 'buyBillController.php', '1739', '', '0', '0'); -- id=1285
UPDATE product SET  productBuyPrice = "1080" WHERE productId = 2399 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1739 ;
UPDATE product SET productName = 'موديل 5115 فور ماكس', productDescription = '', productCatId = '161', productBuyPrice = '1080.00', productSellAllPrice = '1150.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02399',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '1080',lastbuyprice_withDiscount = '1080',meanbuyprice = '1080',meanbuyprice_withDiscount = '1080' , productbuypricereal = '1080.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.48' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='1080',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='1080',meanbuyprice_withTax='1080',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='1080',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2399';
UPDATE buybilldetail SET  lastbuyprice = 1080 , meanbuyprice = 1080, lastbuyprice_withDiscount = 1080, meanbuyprice_withDiscount = 1080
        , lastbuyprice_withTax = 1080, meanbuyprice_withTax = 1080, lastbuyprice_withDiscountAndTax = 1080
                where buybilldetailid = 1739;
UPDATE productunit SET proUnitBuyPrice  = 1080 * productnumber WHERE productid = 2399;
UPDATE storedetail SET  productquantity = '30', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3794';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2399', '1', '30', '0', '321', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '5', '2026-10-22 10:16:57','0','0'); -- id=16432
UPDATE supplier SET  suppliercurrentDebt = '249500',suppliercurrentDebtInCurrency= '249500' , userid = '5', supplierdate = '2026-10-22 10:17:50'   WHERE supplierid = '174';
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 ('174', '196100.00', '53400', '0', 'اضافة فاتورة مشتريات', '321', '249500', '2026-10-22 10:16:57', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','53400','1','196100','53400','249500','0',''); -- id=867
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '53400', '53400', '2026-10-22', '5', '0', '0', '2026-10-22 10:17:50','اضافة فاتورة مشتريات رقم 321','1','0',null,'0','321','buyBillController.php?do=details&id=321'); -- id=4349
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4349', '382', '53400', '','0'); -- id=4466
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26336618.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4349', '657', '53400', '','0'); -- id=4351
UPDATE accountstree SET name = 'فور ماكس', customName = 'فور ماكس', customNameEn = 'فور ماكس', nameEn = 'فور ماكس', parent = '81', accountNature = '1', theValue = '249500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 17:14:24' WHERE id = '657';
update buybill set dailyentryid='4349,0' where buybillid=321;
COMMIT;
UPDATE product SET overAllAveragePrice = 700 WHERE productId = 2398;UPDATE product SET overAllAveragePrice = 1080 WHERE productId = 2399;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:47:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:17:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:17:50', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=321'); -- id=17705
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:47:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:17:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:17:53', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=321&type=2'); -- id=17706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:48:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:18:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:18:13', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17707
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:48:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:18:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:18:13', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:19:00', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:19:23', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17710

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b3f4386dc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:19:23', '06ad9b3f4386dc', '1', '0.00', '0', '0', '1', '13610.00', '13610', '13610', '0', '2', '2026-10-22 10:19:23', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '35' ,'0','','','','','-1','0','0','0','0','0','13610','0','','0','0','13610','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1233
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1233', '0', '2026-10-22 10:19:23', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '13610', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:19:23','0','0','',''); -- id=1461
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1233', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-22 10:19:23', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=4971
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4971;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '972', userid = '4', storedetaildate = '2026-10-22 10:19:23' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '1233', 'اضافة فاتورة مبيعات', 'sellbillController.php', '980', '972', '4', '2026-10-22 10:19:23','0','0'); -- id=16433
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1233', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-22 10:19:23', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=4972
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4972;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '964', userid = '4', storedetaildate = '2026-10-22 10:19:23' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '1233', 'اضافة فاتورة مبيعات', 'sellbillController.php', '972', '964', '4', '2026-10-22 10:19:23','0','0'); -- id=16434
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1233', '86', '1324', '7', '390', '2730', '0', '', '0', '2026-10-22 10:19:23', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-7,','1','1','0','0','390','2730','0','','0','0.00','0','0','0','0'); -- id=4973
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4973;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 2730, 2520, 2520
                    , 2489.41, 2520, 2489.41, 2486.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 2520, 2489.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2489.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2489.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2486.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2489.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2730, 2520, 2520
                    , 2489.41, 2520, 2489.41, 2486.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2489.41, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2489.41
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2489.41
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2486.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2489.41
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '957', userid = '4', storedetaildate = '2026-10-22 10:19:23' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '7', '1', '1233', 'اضافة فاتورة مبيعات', 'sellbillController.php', '964', '957', '4', '2026-10-22 10:19:23','0','0'); -- id=16435
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1233', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-22 10:19:23', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=4974
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 355.63, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 355.63
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 355.63, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 4974;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3120, 2880, 2880
                    , 2845.04, 2880, 2845.04, 2841.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2845.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3120, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2845.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2845.04
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2841.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2845.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '949', userid = '4', storedetaildate = '2026-10-22 10:19:23' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '1233', 'اضافة فاتورة مبيعات', 'sellbillController.php', '957', '949', '4', '2026-10-22 10:19:23','0','0'); -- id=16436
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 495;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01551', '1233', '112', '1551', '4', '380', '1520', '0', '', '0', '2026-10-22 10:19:23', '1551', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','495-4,','1','1','0','0','380','1520','0','','0','0.00','0','0','0','0'); -- id=4975
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 4975;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1551, '2026-10-22', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 1520, 1280, 1280
                    , 1280, 1280, 1280, 1280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1520, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '214', userid = '4', storedetaildate = '2026-10-22 10:19:23' WHERE storedetailid = '2563';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1551', '2', '4', '1', '1233', 'اضافة فاتورة مبيعات', 'sellbillController.php', '218', '214', '4', '2026-10-22 10:19:23','0','0'); -- id=16437
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1206892.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1193282.875','13610', '0', '3', 'اضافة فاتورة مبيعات', '1233', '1206892.875', '2026-10-22 10:19:23', '4',  'sellbillController.php','1','','0'); -- id=1535
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '13610', '13610', '2026-10-22', '4', '0', '0', '2026-10-22 10:19:23','اضافة فاتورة مبيعات رقم 1233','1','0',null,'0','1233','sellbillController.php?do=showDetail&sellbillid=1233'); -- id=4350
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4350', '501', '13610', '','0'); -- id=4467
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1206892.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4350', '143', '13610', '','0'); -- id=4352
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14013150', 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 ( '12440', '12440', '2026-10-22', '4', '0', '0', '2026-10-22 10:19:23','اضافة فاتورة مبيعات رقم 1233 - صرف البضاعة من المخزن','1','0',null,'0','1233','sellbillController.php?do=showDetail&sellbillid=1233'); -- id=4351
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4351', '402', '12440', '','0'); -- id=4468
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12962002.61', 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 ('4351', '492', '12440', '','0'); -- id=4353
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1543259', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4350,0,4351' where sellbillid=1233;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 13610, 12440, 12440
                    , 12304.53, 12440, 12304.53, 12291.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12440, 12304.53, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13610, sellCostBuyPrice =sellCostBuyPrice+12440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12304.53
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12304.53
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12291.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12304.53
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 13610, 12440, 12440
                    , 12304.53, 12440, 12304.53, 12291.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12440, 12304.53, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+13610, sellCostBuyPrice =sellCostBuyPrice+12440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12304.53
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12304.53
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12291.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12304.53
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 13610, 12440, 12440
                    , 12304.53, 12440, 12304.53, 12291.2, 12440, 12304.53)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+13610, netSellCostBuyPrice = netSellCostBuyPrice+12440
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12440
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12304.53
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12440
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12304.53
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12291.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12440
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12304.53;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b3f4386dc and sellbillId = 1233 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:23", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:19:23', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:19:33', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1233'); -- id=17712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:19:35', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=321&type=2'); -- id=17713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:19:37', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=321'); -- id=17714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:19:49', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:49:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:19:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:19:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:02', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17717

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b88d17ce0
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b88d17ce0 and sellbillId = 1234 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:03', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17718
UPDATE product SET productName = 'موديل 490 ضرب نار', productDescription = '', productCatId = '124', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '490.00', productSellHalfPrice = '490.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01674',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490.00',lastbuyprice_withDiscount = '450.8',meanbuyprice = '490.00',meanbuyprice_withDiscount = '450.8' , productbuypricereal = '490.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450.8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='490',meanbuyprice_withTax='490',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1674';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1674, 1,'2026-10-22 10:20:12',7)
                ON DUPLICATE KEY UPDATE productid = 1674, edited = 1, sysdate = '2026-10-22 10:20:12', userid = 7; -- id=2489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:20:13', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:20:14', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17720
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:20', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1217'); -- id=17721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:24", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:24', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:42', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17723

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b8550a515
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:20:42', '06ad9b8550a515', '1', '0.00', '0', '0', '1', '17425.00', '17425', '17425', '0', '1', '2026-10-22 10:20:42', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '28' ,'0','','','','','-1','0','0','0','0','0','17425','0','','0','0','17425','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1235
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1235', '0', '2026-10-22 10:20:42', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17425', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:20:42','0','0','',''); -- id=1463
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+25 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1235', '175', '2088', '25', '595', '14875', '0', '', '0', '2026-10-22 10:20:42', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-25,','1','1','0','0','595','14875','0','','0','0.00','0','0','0','0'); -- id=4978
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4978;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 14875, 11500, 11500
                    , 11500, 11500, 11500, 11500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 25, 0, 11500, 11500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14875, sellCostBuyPrice =sellCostBuyPrice+11500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+25
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 14875, 11500, 11500
                    , 11500, 11500, 11500, 11500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11500, 11500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14875, sellCostBuyPrice =sellCostBuyPrice+11500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1006', userid = '6', storedetaildate = '2026-10-22 10:20:42' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '25', '1', '1235', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1031', '1006', '6', '2026-10-22 10:20:42','0','0'); -- id=16440
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 228;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01453', '1235', '192', '1453', '3', '850', '2550', '0', '', '0', '2026-10-22 10:20:42', '1453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','228-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=4979
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        
                where sellbilldetailid = 4979;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1453, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '6', storedetaildate = '2026-10-22 10:20:42' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1453', '1', '3', '1', '1235', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '123', '6', '2026-10-22 10:20:42','0','0'); -- id=16441
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1117725',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1100300','17425', '0', '4', 'اضافة فاتورة مبيعات', '1235', '1117725', '2026-10-22 10:20:42', '6',  'sellbillController.php','1','','0'); -- id=1537
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17425', '17425', '2026-10-22', '6', '0', '0', '2026-10-22 10:20:42','اضافة فاتورة مبيعات رقم 1235','1','0',null,'0','1235','sellbillController.php?do=showDetail&sellbillid=1235'); -- id=4354
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4354', '568', '17425', '','0'); -- id=4471
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1117725', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4354', '143', '17425', '','0'); -- id=4356
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14037745', 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 ( '13900', '13900', '2026-10-22', '6', '0', '0', '2026-10-22 10:20:42','اضافة فاتورة مبيعات رقم 1235 - صرف البضاعة من المخزن','1','0',null,'0','1235','sellbillController.php?do=showDetail&sellbillid=1235'); -- id=4355
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4355', '402', '13900', '','0'); -- id=4472
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12982697.61', 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 ('4355', '382', '13900', '','0'); -- id=4357
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26315923.89', 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='4354,0,4355' where sellbillid=1235;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 17425, 13900, 13900
                    , 13900, 13900, 13900, 11500
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11500, 11500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17425, sellCostBuyPrice =sellCostBuyPrice+13900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 17425, 13900, 13900
                    , 13900, 13900, 13900, 11500
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11500, 11500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17425, sellCostBuyPrice =sellCostBuyPrice+13900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 17425, 13900, 13900
                    , 13900, 13900, 13900, 11500, 11500, 11500)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17425, netSellCostBuyPrice = netSellCostBuyPrice+13900
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13900
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13900
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13900
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13900
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+11500
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+11500
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+11500;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b8550a515 and sellbillId = 1235 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:50:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:20:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:20:42', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17724
UPDATE product SET productName = 'موديل 475 ضرب نار', productDescription = '', productCatId = '124', productBuyPrice = '475.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01667',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475.00',lastbuyprice_withDiscount = '437',meanbuyprice = '475.00',meanbuyprice_withDiscount = '437' , productbuypricereal = '475.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='437',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='475',meanbuyprice_withTax='475',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='437',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1667';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1667, 1,'2026-10-22 10:21:25',7)
                ON DUPLICATE KEY UPDATE productid = 1667, edited = 1, sysdate = '2026-10-22 10:21:25', userid = 7; -- id=2482
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:51:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:21:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:21:32', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17725
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:51:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:21:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:21:32', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:51:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:21:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:21:32', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17727
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:51:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:21:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:21:38', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1234'); -- id=17728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:52:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:22:17", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:22:17', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17729
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 ('06ad9b97cc7f5c', '2026-10-22 10:21:32', '118', '-46706.20', '-20072.2', '8', '1', '28950.00',  '26634.00', '0', '26634', '1', '2026-10-22 10:22:17', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=322
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 ('01667', '322', '124', '1667', '30', '475', '14250.00', '0', '', '2026-10-22 10:22:17', '1667','','','0','0','0','0','0',null,'475','14250','0','0','0','0','0','0','0','0','1'); -- id=1740
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:21:32', 1, 1667, 0, 0
                    , 437, 30, 0, 0, 7, '2026-10-22 10:22:17')
                ON DUPLICATE KEY UPDATE buyprice = 437,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:22:17' ; -- id=7066
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1667', '475', '30', '0', 'buyBillController.php', '1740', '', '0', '0'); -- id=1286
UPDATE product SET  productBuyPrice = "475" WHERE productId = 1667 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1740 ;
UPDATE product SET productName = 'موديل 475 ضرب نار', productDescription = '', productCatId = '124', productBuyPrice = '475.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01667',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475',lastbuyprice_withDiscount = '437',meanbuyprice = '475',meanbuyprice_withDiscount = '437' , productbuypricereal = '475.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='437',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='475',meanbuyprice_withTax='475',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='437',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1667';
UPDATE buybilldetail SET  lastbuyprice = 475 , meanbuyprice = 475, lastbuyprice_withDiscount = 437, meanbuyprice_withDiscount = 437
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 437
                where buybilldetailid = 1740;
UPDATE productunit SET proUnitBuyPrice  = 475 * productnumber WHERE productid = 1667;
UPDATE storedetail SET  productquantity = '30', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2679';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1667', '1', '30', '0', '322', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '7', '2026-10-22 10:21:32','0','0'); -- id=16442
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 ('01674', '322', '124', '1674', '30', '490', '14700.00', '0', '', '2026-10-22 10:22:17', '1674','','','0','0','0','0','0',null,'490','14700','0','0','0','0','0','0','0','0','1'); -- id=1741
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:21:32', 1, 1674, 0, 0
                    , 450.8, 30, 0, 0, 7, '2026-10-22 10:22:17')
                ON DUPLICATE KEY UPDATE buyprice = 450.8,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:22:17' ; -- id=7067
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1674', '490', '30', '0', 'buyBillController.php', '1741', '', '0', '0'); -- id=1287
UPDATE product SET  productBuyPrice = "490" WHERE productId = 1674 ;
UPDATE buybilldetail SET  quantitybefore = 30 WHERE buybilldetailid = 1741 ;
UPDATE product SET productName = 'موديل 490 ضرب نار', productDescription = '', productCatId = '124', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '490.00', productSellHalfPrice = '490.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01674',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '450.8',meanbuyprice = '490',meanbuyprice_withDiscount = '450.8' , productbuypricereal = '490.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450.8',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='490',meanbuyprice_withTax='490',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1674';
UPDATE buybilldetail SET  lastbuyprice = 490 , meanbuyprice = 490, lastbuyprice_withDiscount = 450.8, meanbuyprice_withDiscount = 450.8
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 450.8
                where buybilldetailid = 1741;
UPDATE productunit SET proUnitBuyPrice  = 490 * productnumber WHERE productid = 1674;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2686';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1674', '1', '30', '0', '322', 'اضافة فاتورة مشتريات', 'buyBillController.php', '30', '60', '7', '2026-10-22 10:21:32','0','0'); -- id=16443
UPDATE supplier SET  suppliercurrentDebt = '-20072.2',suppliercurrentDebtInCurrency= '-20072.2' , userid = '7', supplierdate = '2026-10-22 10:22:17'   WHERE supplierid = '118';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('118', '-46706.20', '26634', '0', 'اضافة فاتورة مشتريات', '322', '-20072.2', '2026-10-22 10:21:32', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','26634','1','-46706.2','26634','-20072.2','0',''); -- id=868
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26634', '26634', '2026-10-22', '7', '0', '0', '2026-10-22 10:22:17','اضافة فاتورة مشتريات رقم 322','1','0',null,'0','322','buyBillController.php?do=details&id=322'); -- id=4356
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4356', '382', '26634', '','0'); -- id=4473
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26342557.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4356', '601', '26634', '','0'); -- id=4358
UPDATE accountstree SET name = 'ضرب نار', customName = 'ضرب نار', customNameEn = 'ضرب نار', nameEn = 'ضرب نار', parent = '81', accountNature = '1', theValue = '-20072.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:25:59' WHERE id = '601';
update buybill set dailyentryid='4356,0' where buybillid=322;
COMMIT;
UPDATE product SET overAllAveragePrice = 437 WHERE productId = 1667;UPDATE product SET overAllAveragePrice = 450.8 WHERE productId = 1674;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:52:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:22:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:22:18', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=322'); -- id=17730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:52:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:22:21", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:22:21', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=322&type=2'); -- id=17731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:52:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:22:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:22:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17732
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:52:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:22:41", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:22:41', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:53:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:23:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:23:12', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=322&type=2'); -- id=17734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:53:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:23:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:23:23', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:53:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:23:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:23:37', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=317'); -- id=17736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:11";
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:24:15', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17737
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:15";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:24:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:24:15', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17738
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:24:16', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17739
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:16";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:24:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:24:16', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17740
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:24:19', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:24:30', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17742

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b9c17d323
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b9c17d323 and sellbillId = 1236 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:24:30', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17743

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b94a945a4
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:24:30', '06ad9b94a945a4', '1', '0.00', '0', '0', '1', '8500.00', '8500', '8500', '0', '1', '2026-10-22 10:24:30', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '13' ,'0','','','','','-1','0','0','0','0','0','8500','0','','0','0','8500','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1237
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1237', '0', '2026-10-22 10:24:30', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8500', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:24:30','0','0','',''); -- id=1465
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 228;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01453', '1237', '192', '1453', '3', '850', '2550', '0', '', '0', '2026-10-22 10:24:30', '1453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','228-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=4981
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        
                where sellbilldetailid = 4981;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1453, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '6', storedetaildate = '2026-10-22 10:24:30' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1453', '1', '3', '1', '1237', 'اضافة فاتورة مبيعات', 'sellbillController.php', '123', '120', '6', '2026-10-22 10:24:30','0','0'); -- id=16445
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1237', '175', '2088', '10', '595', '5950', '0', '', '0', '2026-10-22 10:24:30', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-10,','1','1','0','0','595','5950','0','','0','0.00','0','0','0','0'); -- id=4982
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4982;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 5950, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5950, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5950, 4600, 4600
                    , 4600, 4600, 4600, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5950, sellCostBuyPrice =sellCostBuyPrice+4600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '996', userid = '6', storedetaildate = '2026-10-22 10:24:30' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '10', '1', '1237', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1006', '996', '6', '2026-10-22 10:24:30','0','0'); -- id=16446
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1126225',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1117725','8500', '0', '4', 'اضافة فاتورة مبيعات', '1237', '1126225', '2026-10-22 10:24:30', '6',  'sellbillController.php','1','','0'); -- id=1539
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8500', '8500', '2026-10-22', '6', '0', '0', '2026-10-22 10:24:30','اضافة فاتورة مبيعات رقم 1237','1','0',null,'0','1237','sellbillController.php?do=showDetail&sellbillid=1237'); -- id=4359
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4359', '568', '8500', '','0'); -- id=4476
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1126225', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4359', '143', '8500', '','0'); -- id=4361
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14050610', 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 ( '7000', '7000', '2026-10-22', '6', '0', '0', '2026-10-22 10:24:30','اضافة فاتورة مبيعات رقم 1237 - صرف البضاعة من المخزن','1','0',null,'0','1237','sellbillController.php?do=showDetail&sellbillid=1237'); -- id=4360
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4360', '402', '7000', '','0'); -- id=4477
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12993837.61', 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 ('4360', '382', '7000', '','0'); -- id=4362
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26331417.89', 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='4359,0,4360' where sellbillid=1237;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 8500, 7000, 7000
                    , 7000, 7000, 7000, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8500, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8500, 7000, 7000
                    , 7000, 7000, 7000, 4600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4600, 4600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8500, sellCostBuyPrice =sellCostBuyPrice+7000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 8500, 7000, 7000
                    , 7000, 7000, 7000, 4600, 4600, 4600)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8500, netSellCostBuyPrice = netSellCostBuyPrice+7000
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7000
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7000
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7000
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7000
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4600
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+4600;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b94a945a4 and sellbillId = 1237 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:24:30', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:24:30', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:24:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17746
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:54:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:24:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:24:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:25:32', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17748
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:35", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:25:35', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1237'); -- id=17749
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:25:39', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17750

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ba2e66ca8
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ba2e66ca8 and sellbillId = 1238 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:25:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:25:47', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:59", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:25:59', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:55:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:25:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:25:59', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17754
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:56:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:26:01", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:26:01', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17755
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:56:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:26:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:26:58', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17756
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:56:58";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:26:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:26:58', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17757
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:27:00', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:00", deviceType = "DESKTOP" WHERE userid = 2;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:27:00', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17759
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:27:01', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:27:12', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17761
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:27:27', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17762

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bad1060d1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 10:27:27', '06ad9bad1060d1', '1', '0.00', '0', '0', '1', '1170', '1170', '-1170', '0', '1', '2026-10-22 10:27:27', '', '2', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '3', '0', '', '','','','-1','0','0','0','','0','-1170','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=42
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','42', '0', '2026-10-22 10:27:27', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1170', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:27:27','0','0','',''); -- id=1467
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('350.00', '01380', '42', '94', '1380', '3', '390', '1170', '0', '', '0', '0', '1380', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','390','1170','0','','0'); -- id=60
UPDATE returnsellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where returnsellbilldetailid = 60;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1170, 1050, 1050, 1050
                    , 1050, 1050, 1050, 0, 3, 0, 0, 1050, 1050)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1170, returnSellCostBuyPrice = returnSellCostBuyPrice+1050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1050
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1170, 1050, 1050, 1050
                    , 1050, 1050, 1050, 0, 0, 1050, 1050)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1170, returnSellCostBuyPrice = returnSellCostBuyPrice+1050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1050;
UPDATE storedetail SET  productquantity = '382', userid = '2', storedetaildate = '2026-10-22 10:27:27' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '3', '0', '42', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '379', '382', '2', '2026-10-22 10:27:27','0','0'); -- id=16448
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7744633.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7745803.5','-1170', '1', '2', 'اضافة فاتورة مردوات مبيعات', '42', '7744633.5', '2026-10-22 10:27:27', '2',  'returnsellbillController.php','1','','0'); -- id=1541
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1170', '1170', '2026-10-22', '2', '0', '0', '2026-10-22 10:27:27','اضافة فاتورة مردود مبيعات رقم 42','1','0',null,'0','42','returnsellbillController.php?do=showDetail&returnsellbillid=42'); -- id=4363
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4363', '143', '1170', '','0'); -- id=4480
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14052350', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4363', '419', '1170', '','0'); -- id=4365
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7744633', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1050', '1050', '2026-10-22', '2', '0', '0', '2026-10-22 10:27:27','اضافة فاتورة مردود مبيعات رقم 42 - صرف البضاعة من المخزن','1','0',null,'0','42','returnsellbillController.php?do=showDetail&returnsellbillid=42'); -- id=4364
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4364', '382', '1050', '','0'); -- id=4481
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26329707.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4364', '402', '1050', '','0'); -- id=4366
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '12995547.61', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4363,0,4364' where returnsellbillid=42;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1170, 1050, 1050, 1050
                    , 1050, 1050, 1050 ,0, 0, 1050, 1050)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1170, returnSellCostBuyPrice = returnSellCostBuyPrice+1050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1050;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1170, 1050, 1050, 1050
                    , 1050, 1050, 1050 ,0, 0, 1050, 1050)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1170, returnSellCostBuyPrice = returnSellCostBuyPrice+1050, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1050
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1050, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1050
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1050
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1050
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1050
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1050;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1170, -1050, -1050
                    , -1050, -1050, -1050, -1050, -1050, -1050)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1170, netSellCostBuyPrice = netSellCostBuyPrice+-1050
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1050
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1050
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1050
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1050
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1050
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1050
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1050;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bad1060d1 and sellbillId = 42 and returnsellbillId = 42
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:27:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:27:33', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17764
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:27:40', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=319'); -- id=17765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:40", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:27:40', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17766
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:40", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:27:40', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17767
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:57:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:27:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:27:44', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:14";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:14";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:28:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:28:18', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17769
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:18";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:28:18', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17770
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:28:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:28:46', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17771
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('تطريز كينج براند','','138','435','465','0','0','2026-10-22','0','7','0','','0','0','0','0','0','435','435','435','435','435','0','6.9','0','0','.','0','0','0','435','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','435','435','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','435','0','0','0','0','0','0','','','0','0','0','0'); -- id=2400
UPDATE product SET productName = 'تطريز كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '435', productSellAllPrice = '465', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02400',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '435',lastbuyprice_withDiscount = '435',meanbuyprice = '435',meanbuyprice_withDiscount = '435' , productbuypricereal = '435' , buypricereal_precentage = '0' , buytotal_precentage = '6.9' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='435',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='435',meanbuyprice_withTax='435',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='435',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2400';
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', '2400', '1.00', '2026-10-22', '7', '0','0240001','465','0','0','435','','0','0','0','0','0','0','0','0','0','0'); -- id=2400
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2400', '1', '0', '7', '2026-10-22'); -- id=3795
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2400', '1', '0', '0', '2400', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16449
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2400, 1,'2026-10-22 10:28:46',7)
                ON DUPLICATE KEY UPDATE productid = 2400, edited = 1, sysdate = '2026-10-22 10:28:46', userid = 7; -- id=3577
UPDATE product SET productName = 'تطريز كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '435.00', productSellAllPrice = '465.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02400',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '435',lastbuyprice_withDiscount = '435',meanbuyprice = '435',meanbuyprice_withDiscount = '435' , productbuypricereal = '435' , buypricereal_precentage = '0' , buytotal_precentage = '6.9' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='435',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='435',meanbuyprice_withTax='435',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='435',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2400';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:28:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:28:47', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:58:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:28:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:28:50', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17773
UPDATE product SET productName = 'موديل 445 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '445.00',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.74' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1789, 1,'2026-10-22 10:29:27',7)
                ON DUPLICATE KEY UPDATE productid = 1789, edited = 1, sysdate = '2026-10-22 10:29:27', userid = 7; -- id=2706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:59:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:29:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:29:45', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17774

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ba738e610
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:29:45', '06ad9ba738e610', '1', '0.00', '0', '5', '1', '15505.00', '15500', '15500', '0', '1', '2026-10-22 10:29:45', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '35' ,'0','','','','','-1','0','0','0','0','0','15500','0','','0','0','15500','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1239
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1239', '0', '2026-10-22 10:29:45', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15500', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:29:45','0','0','',''); -- id=1468
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1239', '153', '1921', '5', '485', '2425', '0', '', '0', '2026-10-22 10:29:45', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-5,','1','1','0','0','485','2425','0','','0','0.00','0','0','0','0'); -- id=4984
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4984;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 2424.2179941954, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2424.2179941954, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2424.2179941954, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2424.2179941954, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '175', userid = '3', storedetaildate = '2026-10-22 10:29:45' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '5', '1', '1239', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '175', '3', '2026-10-22 10:29:45','0','0'); -- id=16450
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6145;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','01922', '1239', '153', '1922', '6', '350', '2100', '0', '', '0', '2026-10-22 10:29:45', '1922', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6145-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=4985
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 4985;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1922, '2026-10-22', 2099.3227990971, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2099.3227990971, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2099.3227990971, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2099.3227990971, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 10:29:45' WHERE storedetailid = '2939';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1922', '1', '6', '1', '1239', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '3', '2026-10-22 10:29:45','0','0'); -- id=16451
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1239', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 10:29:45', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=4986
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4986;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4228.6359238955, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.6359238955, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4228.6359238955, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.6359238955, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '413', userid = '3', storedetaildate = '2026-10-22 10:29:45' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1239', 'اضافة فاتورة مبيعات', 'sellbillController.php', '422', '413', '3', '2026-10-22 10:29:45','0','0'); -- id=16452
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1239', '207', '2380', '15', '450', '6750', '0', '', '0', '2026-10-22 10:29:45', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-15,','1','1','0','0','450','6750','0','','0','0.00','0','0','0','0'); -- id=4987
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4987;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 6747.823282812, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6747.823282812, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6747.823282812, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6747.823282812, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '404', userid = '3', storedetaildate = '2026-10-22 10:29:45' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '15', '1', '1239', 'اضافة فاتورة مبيعات', 'sellbillController.php', '419', '404', '3', '2026-10-22 10:29:45','0','0'); -- id=16453
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7760133.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7744633.5','15500', '0', '2', 'اضافة فاتورة مبيعات', '1239', '7760133.5', '2026-10-22 10:29:45', '3',  'sellbillController.php','1','','0'); -- id=1542
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15505', '15505', '2026-10-22', '3', '0', '0', '2026-10-22 10:29:45','اضافة فاتورة مبيعات رقم 1239','1','0',null,'0','1239','sellbillController.php?do=showDetail&sellbillid=1239'); -- id=4365
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4365', '419', '15500', '','0'); -- id=4482
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7760133', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4365', '398', '5', '','0'); -- id=4483
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510514.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4365', '143', '15505', '','0'); -- id=4367
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14067855', 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 ( '14750', '14750', '2026-10-22', '3', '0', '0', '2026-10-22 10:29:45','اضافة فاتورة مبيعات رقم 1239 - صرف البضاعة من المخزن','1','0',null,'0','1239','sellbillController.php?do=showDetail&sellbillid=1239'); -- id=4366
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4366', '402', '14750', '','0'); -- id=4484
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13010297.61', 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 ('4366', '382', '14750', '','0'); -- id=4368
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26314957.89', 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='4365,0,4366' where sellbillid=1239;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15500, 14750, 14750
                    , 14750, 14750, 14750, 14750
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14750, 14750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15500, sellCostBuyPrice =sellCostBuyPrice+14750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15500, 14750, 14750
                    , 14750, 14750, 14750, 14750
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14750, 14750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15500, sellCostBuyPrice =sellCostBuyPrice+14750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14750, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14750
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14750
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 15500, 14750, 14750
                    , 14750, 14750, 14750, 14750, 14750, 14750)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15500, netSellCostBuyPrice = netSellCostBuyPrice+14750
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14750
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14750
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14750
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14750
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14750
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14750
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14750;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ba738e610 and sellbillId = 1239 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 06:59:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:29:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:29:45', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17775
UPDATE product SET productName = 'موديل 475 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '445.00',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.74' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1789, 1,'2026-10-22 10:29:47',7)
                ON DUPLICATE KEY UPDATE productid = 1789, edited = 1, sysdate = '2026-10-22 10:29:47', userid = 7; -- id=2706
UPDATE product SET productName = 'موديل 6 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '410.00', productSellAllPrice = '440.00', productSellUnitPrice = '440.00', productSellHalfPrice = '440.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01787',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410.00',lastbuyprice_withDiscount = '410',meanbuyprice = '410.00',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.32' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1787';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1787, 1,'2026-10-22 10:29:48',7)
                ON DUPLICATE KEY UPDATE productid = 1787, edited = 1, sysdate = '2026-10-22 10:29:48', userid = 7; -- id=2704
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:00:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:30:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:30:09', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17776
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:00:09";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:30:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:30:09', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17777
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:00:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:30:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:30:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17778
UPDATE product SET productName = 'موديل 455 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '425.00', productSellAllPrice = '455.00', productSellUnitPrice = '455.00', productSellHalfPrice = '455.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01793',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425.00',lastbuyprice_withDiscount = '425',meanbuyprice = '425.00',meanbuyprice_withDiscount = '425' , productbuypricereal = '425.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.06' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='425',meanbuyprice_withTax='425',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1793';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1793, 1,'2026-10-22 10:30:53',7)
                ON DUPLICATE KEY UPDATE productid = 1793, edited = 1, sysdate = '2026-10-22 10:30:53', userid = 7; -- id=2710
UPDATE product SET productName = 'موديل 11 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '470.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01792',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470.00',lastbuyprice_withDiscount = '470',meanbuyprice = '470.00',meanbuyprice_withDiscount = '470' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.38' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1792';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1792, 1,'2026-10-22 10:30:54',7)
                ON DUPLICATE KEY UPDATE productid = 1792, edited = 1, sysdate = '2026-10-22 10:30:54', userid = 7; -- id=2709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:31:16', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17779
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 ('06ad9bb32a7753', '2026-10-22 10:28:50', '134', '114245.00', '153425', '0', '0', '39180.00',  '39180.00', '0', '39180', '1', '2026-10-22 10:31:16', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=323
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01789', '323', '138', '1789', '30', '445', '13350.00', '0', '', '2026-10-22 10:31:16', '1789','','','0','0','0','0','0',null,'445','13350','0','0','0','0','0','0','0','0','1'); -- id=1742
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:28:50', 1, 1789, 0, 0
                    , 445, 30, 0, 0, 7, '2026-10-22 10:31:16')
                ON DUPLICATE KEY UPDATE buyprice = 445,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:31:16' ; -- id=7068
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1789', '445', '30', '0', 'buyBillController.php', '1742', '', '0', '0'); -- id=1288
UPDATE product SET  productBuyPrice = "445" WHERE productId = 1789 ;
UPDATE buybilldetail SET  quantitybefore = 21 WHERE buybilldetailid = 1742 ;
UPDATE product SET productName = 'موديل 475 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '445.00', productSellAllPrice = '475.00', productSellUnitPrice = '475.00', productSellHalfPrice = '475.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01789',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.74' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1789';
UPDATE buybilldetail SET  lastbuyprice = 445 , meanbuyprice = 445, lastbuyprice_withDiscount = 445, meanbuyprice_withDiscount = 445
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 445
                where buybilldetailid = 1742;
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 1789;
UPDATE storedetail SET  productquantity = '51', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2802';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1789', '1', '30', '0', '323', 'اضافة فاتورة مشتريات', 'buyBillController.php', '21', '51', '7', '2026-10-22 10:28:50','0','0'); -- id=16454
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 ('02400', '323', '138', '2400', '33', '435', '14355.00', '0', '', '2026-10-22 10:31:16', '2400','','','0','0','0','0','0',null,'435','14355','0','0','0','0','0','0','0','0','1'); -- id=1743
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:28:50', 1, 2400, 0, 0
                    , 435, 33, 0, 0, 7, '2026-10-22 10:31:16')
                ON DUPLICATE KEY UPDATE buyprice = 435,
                        buyQuantity =buyQuantity+33, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:31:16' ; -- id=7069
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2400', '435', '33', '0', 'buyBillController.php', '1743', '', '0', '0'); -- id=1289
UPDATE product SET  productBuyPrice = "435" WHERE productId = 2400 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1743 ;
UPDATE product SET productName = 'تطريز كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '435.00', productSellAllPrice = '465.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02400',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '435',lastbuyprice_withDiscount = '435',meanbuyprice = '435',meanbuyprice_withDiscount = '435' , productbuypricereal = '435.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='435',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='435',meanbuyprice_withTax='435',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='435',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2400';
UPDATE buybilldetail SET  lastbuyprice = 435 , meanbuyprice = 435, lastbuyprice_withDiscount = 435, meanbuyprice_withDiscount = 435
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where buybilldetailid = 1743;
UPDATE productunit SET proUnitBuyPrice  = 435 * productnumber WHERE productid = 2400;
UPDATE storedetail SET  productquantity = '33', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3795';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2400', '1', '33', '0', '323', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '33', '7', '2026-10-22 10:28:50','0','0'); -- id=16455
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01793', '323', '138', '1793', '27', '425', '11475.00', '0', '', '2026-10-22 10:31:16', '1793','','','0','0','0','0','0',null,'425','11475','0','0','0','0','0','0','0','0','1'); -- id=1744
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:28:50', 1, 1793, 0, 0
                    , 425, 27, 0, 0, 7, '2026-10-22 10:31:16')
                ON DUPLICATE KEY UPDATE buyprice = 425,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:31:16' ; -- id=7070
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1793', '425', '27', '0', 'buyBillController.php', '1744', '', '0', '0'); -- id=1290
UPDATE product SET  productBuyPrice = "425" WHERE productId = 1793 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1744 ;
UPDATE product SET productName = 'موديل 455 كينج براند', productDescription = '', productCatId = '138', productBuyPrice = '425.00', productSellAllPrice = '455.00', productSellUnitPrice = '455.00', productSellHalfPrice = '455.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01793',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425',lastbuyprice_withDiscount = '425',meanbuyprice = '425',meanbuyprice_withDiscount = '425' , productbuypricereal = '425.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.06' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='425',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='425',meanbuyprice_withTax='425',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='425',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1793';
UPDATE buybilldetail SET  lastbuyprice = 425 , meanbuyprice = 425, lastbuyprice_withDiscount = 425, meanbuyprice_withDiscount = 425
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where buybilldetailid = 1744;
UPDATE productunit SET proUnitBuyPrice  = 425 * productnumber WHERE productid = 1793;
UPDATE storedetail SET  productquantity = '27', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '27', '0', '323', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '7', '2026-10-22 10:28:50','0','0'); -- id=16456
UPDATE supplier SET  suppliercurrentDebt = '153425',suppliercurrentDebtInCurrency= '153425' , userid = '7', supplierdate = '2026-10-22 10:31:16'   WHERE supplierid = '134';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('134', '114245.00', '39180', '0', 'اضافة فاتورة مشتريات', '323', '153425', '2026-10-22 10:28:50', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','39180','1','114245','39180','153425','0',''); -- id=869
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '39180', '39180', '2026-10-22', '7', '0', '0', '2026-10-22 10:31:16','اضافة فاتورة مشتريات رقم 323','1','0',null,'0','323','buyBillController.php?do=details&id=323'); -- id=4367
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4367', '382', '39180', '','0'); -- id=4485
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26354137.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4367', '617', '39180', '','0'); -- id=4369
UPDATE accountstree SET name = 'كينج براند', customName = 'كينج براند', customNameEn = 'كينج براند', nameEn = 'كينج براند', parent = '81', accountNature = '1', theValue = '153425', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 13:05:03' WHERE id = '617';
update buybill set dailyentryid='4367,0' where buybillid=323;
COMMIT;
UPDATE product SET overAllAveragePrice = 445 WHERE productId = 1789;UPDATE product SET overAllAveragePrice = 425 WHERE productId = 1793;UPDATE product SET overAllAveragePrice = 435 WHERE productId = 2400;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:31:16', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=323'); -- id=17780
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:31:22', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=323&type=2'); -- id=17781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 10:31:31', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=17782
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 10:31:48', '5', 'autosave', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=17783
UPDATE storedetail SET  productquantity = '6', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2192', '1', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0', '6', '5', '2026-10-22','0','0'); -- id=16457
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2100', '2100', '2026-10-22', '5', '0', '0', '2026-10-22 10:31:48','اعادة جرد للمنتج : (تيشيرت سوسته الكاشف/احمد الكاشف) فى مخزن : (المخزن الرئيسي) بالكمية : 6','1','0',null,'0','16457','inventoryController.php?do=details&id=16457'); -- id=4368
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4368', '382', '2100', '','0'); -- id=4486
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26356237.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4368', '188', '2100', '','0'); -- id=4370
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3247410', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:31:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:31:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17784
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:01:55";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:31:55', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:32:05', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=323&type=2'); -- id=17786
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:32:26', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17787
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:26";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:32:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:32:26', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17788
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:32:28', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17789
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:33", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:32:33', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17790

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b7851475e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:32:33', '06ad9b7851475e', '1', '0.00', '0', '25', '1', '15195.00', '15170', '15170', '0', '1', '2026-10-22 10:32:33', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '33' ,'0','','','','','-1','0','0','0','0','0','15170','0','','0','0','15170','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1240
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1240', '0', '2026-10-22 10:32:33', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15170', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:32:33','0','0','',''); -- id=1469
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1240', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 10:32:33', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=4988
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 4988;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2815.3603158934, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2815.3603158934, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2815.3603158934, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2815.3603158934, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '407', userid = '2', storedetaildate = '2026-10-22 10:32:33' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1240', 'اضافة فاتورة مبيعات', 'sellbillController.php', '413', '407', '2', '2026-10-22 10:32:33','0','0'); -- id=16458
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1240', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 10:32:33', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=4989
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 4989;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2695.5577492596, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2695.5577492596, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2695.5577492596, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2695.5577492596, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '398', userid = '2', storedetaildate = '2026-10-22 10:32:33' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1240', 'اضافة فاتورة مبيعات', 'sellbillController.php', '404', '398', '2', '2026-10-22 10:32:33','0','0'); -- id=16459
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','02192', '1240', '94', '2192', '6', '400', '2400', '0', '', '0', '2026-10-22 10:32:33', '2192', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=4990
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 4990;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2192, '2026-10-22', 2396.0513326752, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2396.0513326752, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2396.0513326752, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2396.0513326752, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 10:32:33' WHERE storedetailid = '3560';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2192', '1', '6', '1', '1240', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '0', '2', '2026-10-22 10:32:33','0','0'); -- id=16460
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1240', '153', '1921', '15', '485', '7275', '0', '', '0', '2026-10-22 10:32:33', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-15,','1','1','0','0','485','7275','0','','0','0.00','0','0','0','0'); -- id=4991
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 4991;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 7263.0306021718, 6900, 6900
                    , 6900, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 6900, 6900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7263.0306021718, sellCostBuyPrice =sellCostBuyPrice+6900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7263.0306021718, 6900, 6900
                    , 6900, 6900, 6900, 6900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6900, 6900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7263.0306021718, sellCostBuyPrice =sellCostBuyPrice+6900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '160', userid = '2', storedetaildate = '2026-10-22 10:32:33' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '15', '1', '1240', 'اضافة فاتورة مبيعات', 'sellbillController.php', '175', '160', '2', '2026-10-22 10:32:33','0','0'); -- id=16461
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7775303.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7760133.5','15170', '0', '2', 'اضافة فاتورة مبيعات', '1240', '7775303.5', '2026-10-22 10:32:33', '2',  'sellbillController.php','1','','0'); -- id=1543
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15195', '15195', '2026-10-22', '2', '0', '0', '2026-10-22 10:32:33','اضافة فاتورة مبيعات رقم 1240','1','0',null,'0','1240','sellbillController.php?do=showDetail&sellbillid=1240'); -- id=4369
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4369', '419', '15170', '','0'); -- id=4487
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7775303', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4369', '398', '25', '','0'); -- id=4488
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510539.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4369', '143', '15195', '','0'); -- id=4371
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14083050', 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 ( '14280', '14280', '2026-10-22', '2', '0', '0', '2026-10-22 10:32:33','اضافة فاتورة مبيعات رقم 1240 - صرف البضاعة من المخزن','1','0',null,'0','1240','sellbillController.php?do=showDetail&sellbillid=1240'); -- id=4370
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4370', '402', '14280', '','0'); -- id=4489
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13024577.61', 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 ('4370', '382', '14280', '','0'); -- id=4372
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26341957.89', 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='4369,0,4370' where sellbillid=1240;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15170, 14280, 14280
                    , 14280, 14280, 14280, 14280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14280, 14280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15170, sellCostBuyPrice =sellCostBuyPrice+14280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15170, 14280, 14280
                    , 14280, 14280, 14280, 14280
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14280, 14280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15170, sellCostBuyPrice =sellCostBuyPrice+14280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 15170, 14280, 14280
                    , 14280, 14280, 14280, 14280, 14280, 14280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15170, netSellCostBuyPrice = netSellCostBuyPrice+14280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14280
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14280
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14280
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b7851475e and sellbillId = 1240 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:33", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:32:33', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17791
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:32:47', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17792

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bb83e9e7a
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bb83e9e7a and sellbillId = 1241 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:02:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:32:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:32:47', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:03:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:33:28", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:33:28', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17794

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bb69b15df
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bb69b15df and sellbillId = 1242 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b938c37b8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:33:33', '06ad9b938c37b8', '1', '0.00', '0', '0', '1', '19450.00', '19450', '19450', '0', '2', '2026-10-22 10:33:33', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '49' ,'0','','','','','-1','0','0','0','0','0','19450','0','','0','0','19450','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1243
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1243', '0', '2026-10-22 10:33:33', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '19450', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:33:33','0','0','',''); -- id=1472
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7041;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('725','02351', '1243', '103', '2351', '9', '750', '6750', '0', '', '0', '2026-10-22 10:33:33', '2351', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','7041-9,','1','1','0','0','750','6750','0','','0','0.00','0','0','0','0'); -- id=4994
UPDATE sellbilldetail SET  lastbuyprice = 725.00 , meanbuyprice = 725.00, lastbuyprice_withDiscount = 725.00, meanbuyprice_withDiscount = 725.00
        , lastbuyprice_withTax = 725, meanbuyprice_withTax = 725, lastbuyprice_withDiscountAndTax = 725
                where sellbilldetailid = 4994;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2351, '2026-10-22', 6750, 6525, 6525
                    , 6525, 6525, 6525, 6525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6525, 6525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 6750, 6525, 6525
                    , 6525, 6525, 6525, 6525
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6525, 6525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6525
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6525, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6525
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6525
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6525
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6525
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '4', storedetaildate = '2026-10-22 10:33:33' WHERE storedetailid = '3783';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2351', '2', '9', '1', '1243', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '12', '4', '2026-10-22 10:33:33','0','0'); -- id=16464
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+16 where id = 6442;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','02042', '1243', '167', '2042', '16', '280', '4480', '0', '', '0', '2026-10-22 10:33:33', '2042', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6442-16,','1','1','0','0','280','4480','0','','0','0.00','0','0','0','0'); -- id=4995
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 125, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 4995;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2042, '2026-10-22', 4480, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 16, 0, 4000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4480, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+16
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 4480, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 2000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4480, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '340', userid = '4', storedetaildate = '2026-10-22 10:33:33' WHERE storedetailid = '3572';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2042', '2', '16', '1', '1243', 'اضافة فاتورة مبيعات', 'sellbillController.php', '356', '340', '4', '2026-10-22 10:33:33','0','0'); -- id=16465
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6445;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','02200', '1243', '167', '2200', '12', '290', '3480', '0', '', '0', '2026-10-22 10:33:33', '2200', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6445-12,','1','1','0','0','290','3480','0','','0','0.00','0','0','0','0'); -- id=4996
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 4996;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2200, '2026-10-22', 3480, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3480, 3120, 3120
                    , 3120, 3120, 3120, 3120
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3120
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3120
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '112', userid = '4', storedetaildate = '2026-10-22 10:33:33' WHERE storedetailid = '3575';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2200', '2', '12', '1', '1243', 'اضافة فاتورة مبيعات', 'sellbillController.php', '124', '112', '4', '2026-10-22 10:33:33','0','0'); -- id=16466
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6453;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('355.5','02121', '1243', '182', '2121', '12', '395', '4740', '0', '', '0', '2026-10-22 10:33:33', '2121', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6453-12,','1','1','0','0','395','4740','0','','0','0.00','0','0','0','0'); -- id=4997
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 355.50, meanbuyprice_withDiscount = 375.25
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 197.5, lastbuyprice_withDiscountAndTax = 355.5
                where sellbilldetailid = 4997;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2121, '2026-10-22', 4740, 4740, 4740
                    , 4740, 4266, 4503, 4266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4740, 2370, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4740, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4503
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2370
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 4740, 4740, 4740
                    , 4740, 4266, 4503, 4266
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4740, 2370, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4740, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4266, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4503
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4266
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2370
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '4', storedetaildate = '2026-10-22 10:33:33' WHERE storedetailid = '3579';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2121', '2', '12', '1', '1243', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '18', '4', '2026-10-22 10:33:33','0','0'); -- id=16467
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1226342.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1206892.875','19450', '0', '3', 'اضافة فاتورة مبيعات', '1243', '1226342.875', '2026-10-22 10:33:33', '4',  'sellbillController.php','1','','0'); -- id=1546
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19450', '19450', '2026-10-22', '4', '0', '0', '2026-10-22 10:33:33','اضافة فاتورة مبيعات رقم 1243','1','0',null,'0','1243','sellbillController.php?do=showDetail&sellbillid=1243'); -- id=4375
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4375', '501', '19450', '','0'); -- id=4494
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1226342.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4375', '143', '19450', '','0'); -- id=4377
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14123060', 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 ( '17911', '17911', '2026-10-22', '4', '0', '0', '2026-10-22 10:33:33','اضافة فاتورة مبيعات رقم 1243 - صرف البضاعة من المخزن','1','0',null,'0','1243','sellbillController.php?do=showDetail&sellbillid=1243'); -- id=4376
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4376', '402', '17911', '','0'); -- id=4495
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13061888.61', 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 ('4376', '492', '17911', '','0'); -- id=4378
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1525348', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4375,0,4376' where sellbillid=1243;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 19450, 18385, 18385
                    , 18385, 17911, 18148, 17911
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18385, 14015, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19450, sellCostBuyPrice =sellCostBuyPrice+18385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17911, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17911
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14015
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 19450, 18385, 18385
                    , 18385, 17911, 18148, 17911
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18385, 14015, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19450, sellCostBuyPrice =sellCostBuyPrice+18385
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18385, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18385
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17911, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18148
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17911
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18385
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14015
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 19450, 18385, 18385
                    , 18385, 17911, 18148, 17911, 18385, 14015)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19450, netSellCostBuyPrice = netSellCostBuyPrice+18385
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18385
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18385
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+17911
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18148
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+17911
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18385
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14015;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b938c37b8 and sellbillId = 1243 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:03:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:33:33", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:33:33', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17797
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:03:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:33:39", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:33:39', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1243'); -- id=17798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:04:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:34:38", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:34:38', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17799
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:05:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:35:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 10:35:07', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17800
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:05:07";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:35:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 10:35:07', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17801
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:05:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:35:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:35:09', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:05:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:35:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:35:17', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17803

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bc1f9e6b6
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:35:17', '06ad9bc1f9e6b6', '1', '0.00', '0', '0', '1', '14750.00', '14750', '14750', '0', '1', '2026-10-22 10:35:17', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '31' ,'0','','','','','-1','0','0','0','0','0','14750','0','','0','0','14750','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1244
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1244', '0', '2026-10-22 10:35:17', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14750', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:35:17','0','0','',''); -- id=1473
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 1124;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('617','01936', '1244', '8', '1936', '5', '645', '3225', '0', '', '0', '2026-10-22 10:35:17', '1936', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1124-5,','1','1','0','0','645','3225','0','','0','0.00','0','0','0','0'); -- id=4998
UPDATE sellbilldetail SET  lastbuyprice = 617.00 , meanbuyprice = 617.00, lastbuyprice_withDiscount = 617.00, meanbuyprice_withDiscount = 617.00
        , lastbuyprice_withTax = 617, meanbuyprice_withTax = 617, lastbuyprice_withDiscountAndTax = 617
                where sellbilldetailid = 4998;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1936, '2026-10-22', 3225, 3085, 3085
                    , 3085, 3085, 3085, 3085
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 3085, 3085, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3225, sellCostBuyPrice =sellCostBuyPrice+3085
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3085, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3085
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3085, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3085
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3085
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3085
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3085
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3225, 3085, 3085
                    , 3085, 3085, 3085, 3085
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3085, 3085, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3225, sellCostBuyPrice =sellCostBuyPrice+3085
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3085, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3085
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3085, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3085
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3085
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3085
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3085
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2026-10-22 10:35:17' WHERE storedetailid = '2953';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1936', '1', '5', '1', '1244', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '2', '2026-10-22 10:35:17','0','0'); -- id=16468
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6969;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','02352', '1244', '27', '2352', '5', '415', '2075', '0', '', '0', '2026-10-22 10:35:17', '2352', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6969-5,','1','1','0','0','415','2075','0','','0','0.00','0','0','0','0'); -- id=4999
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 4999;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2352, '2026-10-22', 2075, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2075, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2075, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '2', storedetaildate = '2026-10-22 10:35:17' WHERE storedetailid = '3746';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2352', '1', '5', '1', '1244', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '75', '2', '2026-10-22 10:35:17','0','0'); -- id=16469
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1244', '207', '2380', '21', '450', '9450', '0', '', '0', '2026-10-22 10:35:17', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-21,','1','1','0','0','450','9450','0','','0','0.00','0','0','0','0'); -- id=5000
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5000;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 9450, 9030, 9030
                    , 9030, 9030, 9030, 9030
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 9030, 9030, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+9030
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9030, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9030
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9030
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9030
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9030
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9030
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 9450, 9030, 9030
                    , 9030, 9030, 9030, 9030
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9030, 9030, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+9030
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9030, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9030
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9030, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9030
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9030
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9030
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9030
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '377', userid = '2', storedetaildate = '2026-10-22 10:35:17' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '21', '1', '1244', 'اضافة فاتورة مبيعات', 'sellbillController.php', '398', '377', '2', '2026-10-22 10:35:17','0','0'); -- id=16470
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7810613.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7795863.5','14750', '0', '2', 'اضافة فاتورة مبيعات', '1244', '7810613.5', '2026-10-22 10:35:17', '2',  'sellbillController.php','1','','0'); -- id=1547
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14750', '14750', '2026-10-22', '2', '0', '0', '2026-10-22 10:35:17','اضافة فاتورة مبيعات رقم 1244','1','0',null,'0','1244','sellbillController.php?do=showDetail&sellbillid=1244'); -- id=4377
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4377', '419', '14750', '','0'); -- id=4496
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7810613', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4377', '143', '14750', '','0'); -- id=4379
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14137810', 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 ( '14115', '14115', '2026-10-22', '2', '0', '0', '2026-10-22 10:35:17','اضافة فاتورة مبيعات رقم 1244 - صرف البضاعة من المخزن','1','0',null,'0','1244','sellbillController.php?do=showDetail&sellbillid=1244'); -- id=4378
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4378', '402', '14115', '','0'); -- id=4497
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13076003.61', 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 ('4378', '382', '14115', '','0'); -- id=4380
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26308442.89', 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='4377,0,4378' where sellbillid=1244;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 14750, 14115, 14115
                    , 14115, 14115, 14115, 14115
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14115, 13115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14750, sellCostBuyPrice =sellCostBuyPrice+14115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 14750, 14115, 14115
                    , 14115, 14115, 14115, 14115
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14115, 13115, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14750, sellCostBuyPrice =sellCostBuyPrice+14115
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14115, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14115
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14115, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14115
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14115
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14115
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13115
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 14750, 14115, 14115
                    , 14115, 14115, 14115, 14115, 14115, 13115)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14750, netSellCostBuyPrice = netSellCostBuyPrice+14115
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14115
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14115
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14115
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14115
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14115
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14115
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13115;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bc1f9e6b6 and sellbillId = 1244 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:05:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:35:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:35:17', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17804
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:06:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:36:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:36:56', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:10", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:37:10', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17806
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:34", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:37:34', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17807

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ba8a06d11
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:37:34', '06ad9ba8a06d11', '1', '0.00', '0', '0', '1', '14355.00', '14355', '14355', '0', '1', '2026-10-22 10:37:34', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','14355','0','','0','0','14355','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1245
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1245', '0', '2026-10-22 10:37:34', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14355', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:37:34','0','0','',''); -- id=1474
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 348;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','01503', '1245', '108', '1503', '3', '600', '1800', '0', '', '0', '2026-10-22 10:37:34', '1503', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','348-3,','1','1','0','0','600','1800','0','','0','0.00','0','0','0','0'); -- id=5001
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5001;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1503, '2026-10-22', 1800, 1740, 1740
                    , 1740, 1740, 1740, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1740, 1740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1800, 1740, 1740
                    , 1740, 1740, 1740, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1740, 1740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1800, sellCostBuyPrice =sellCostBuyPrice+1740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '6', storedetaildate = '2026-10-22 10:37:34' WHERE storedetailid = '1528';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1503', '1', '3', '1', '1245', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '6', '2026-10-22 10:37:34','0','0'); -- id=16471
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6799;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','02291', '1245', '203', '2291', '6', '450', '2700', '0', '', '0', '2026-10-22 10:37:34', '2291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6799-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5002
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 5002;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2291, '2026-10-22', 2700, 2520, 2520
                    , 2520, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2520, 2520
                    , 2520, 2520, 2520, 2520
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2520, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2520
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2520
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '108', userid = '6', storedetaildate = '2026-10-22 10:37:34' WHERE storedetailid = '3684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2291', '1', '6', '1', '1245', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '108', '6', '2026-10-22 10:37:34','0','0'); -- id=16472
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 950;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('600','01861', '1245', '108', '1861', '6', '625', '3750', '0', '', '0', '2026-10-22 10:37:34', '1861', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','950-6,','1','1','0','0','625','3750','0','','0','0.00','0','0','0','0'); -- id=5003
UPDATE sellbilldetail SET  lastbuyprice = 600.00 , meanbuyprice = 600.00, lastbuyprice_withDiscount = 600.00, meanbuyprice_withDiscount = 600.00
        , lastbuyprice_withTax = 600, meanbuyprice_withTax = 600, lastbuyprice_withDiscountAndTax = 600
                where sellbilldetailid = 5003;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1861, '2026-10-22', 3750, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3750, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3750, 3600, 3600
                    , 3600, 3600, 3600, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3750, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '6', storedetaildate = '2026-10-22 10:37:34' WHERE storedetailid = '2878';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1861', '1', '6', '1', '1245', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '6', '2026-10-22 10:37:34','0','0'); -- id=16473
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 231;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('500','01454', '1245', '102', '1454', '3', '550', '1650', '0', '', '0', '2026-10-22 10:37:34', '1454', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','231-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=5004
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 500.00, meanbuyprice_withDiscount = 500.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 500
                where sellbilldetailid = 5004;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1454, '2026-10-22', 1650, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1650, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '138', userid = '6', storedetaildate = '2026-10-22 10:37:34' WHERE storedetailid = '1479';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1454', '1', '3', '1', '1245', 'اضافة فاتورة مبيعات', 'sellbillController.php', '141', '138', '6', '2026-10-22 10:37:34','0','0'); -- id=16474
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7021;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('455.4','02376', '1245', '111', '2376', '9', '495', '4455', '0', '', '0', '2026-10-22 10:37:34', '2376', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7021-9,','1','1','0','0','495','4455','0','','0','0.00','0','0','0','0'); -- id=5005
UPDATE sellbilldetail SET  lastbuyprice = 495.00 , meanbuyprice = 495.00, lastbuyprice_withDiscount = 455.40, meanbuyprice_withDiscount = 455.40
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 495, lastbuyprice_withDiscountAndTax = 455.4
                where sellbilldetailid = 5005;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2376, '2026-10-22', 4455, 4455, 4455
                    , 4455, 4098.6, 4098.6, 4098.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4455, 4455, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4455, sellCostBuyPrice =sellCostBuyPrice+4455
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4455
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4098.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4098.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4098.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4455
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4455
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4455, 4455, 4455
                    , 4455, 4098.6, 4098.6, 4098.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4455, 4455, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4455, sellCostBuyPrice =sellCostBuyPrice+4455
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4455, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4455
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4098.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4098.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4098.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4455
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4455
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '6', storedetaildate = '2026-10-22 10:37:34' WHERE storedetailid = '3770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2376', '1', '9', '1', '1245', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '6', '2026-10-22 10:37:34','0','0'); -- id=16475
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1140580',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1126225','14355', '0', '4', 'اضافة فاتورة مبيعات', '1245', '1140580', '2026-10-22 10:37:34', '6',  'sellbillController.php','1','','0'); -- id=1548
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14355', '14355', '2026-10-22', '6', '0', '0', '2026-10-22 10:37:34','اضافة فاتورة مبيعات رقم 1245','1','0',null,'0','1245','sellbillController.php?do=showDetail&sellbillid=1245'); -- id=4379
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4379', '568', '14355', '','0'); -- id=4498
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1140580', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4379', '143', '14355', '','0'); -- id=4381
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14152165', 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 ( '13458.6', '13458.6', '2026-10-22', '6', '0', '0', '2026-10-22 10:37:34','اضافة فاتورة مبيعات رقم 1245 - صرف البضاعة من المخزن','1','0',null,'0','1245','sellbillController.php?do=showDetail&sellbillid=1245'); -- id=4380
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4380', '402', '13458.6', '','0'); -- id=4499
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13089462.21', 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 ('4380', '382', '13458.6', '','0'); -- id=4382
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26294984.29', 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='4379,0,4380' where sellbillid=1245;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 14355, 13815, 13815
                    , 13815, 13458.6, 13458.6, 13458.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13815, 13815, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14355, sellCostBuyPrice =sellCostBuyPrice+13815
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13815, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13815
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13458.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13458.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13458.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13815
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13815
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 14355, 13815, 13815
                    , 13815, 13458.6, 13458.6, 13458.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13815, 13815, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14355, sellCostBuyPrice =sellCostBuyPrice+13815
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13815, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13815
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13458.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13458.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13458.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13815
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13815
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 14355, 13815, 13815
                    , 13815, 13458.6, 13458.6, 13458.6, 13815, 13815)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14355, netSellCostBuyPrice = netSellCostBuyPrice+13815
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13815
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13815
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13458.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13458.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13458.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+13815
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13815;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ba8a06d11 and sellbillId = 1245 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:34", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:37:34', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17808
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:37:47', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:37:47', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:07:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:37:58", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:37:58', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1245'); -- id=17811
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:08:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:38:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 10:38:28', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:08:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:38:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:38:31', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:08:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:38:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:38:32', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17814
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:08:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:38:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 10:38:59', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=17815
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('سولدر ','2026-10-22','','93', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=210
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (210, 1,'2026-10-22 10:38:59',7)
                ON DUPLICATE KEY UPDATE catid = 210, edited = 1, sysdate = '2026-10-22 10:38:59', userid = 7; -- id=225
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '210', '1', '2026-10-22', '7', '0'); -- id=100
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:08:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:38:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 10:38:59', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=17816
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:09:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:39:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 10:39:01', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=17817
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:10:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:40:17", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:40:17', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:10:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:40:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:40:18', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17819
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('قصات فوم ايه ثري ','','122','500','500','0','0','2026-10-22','0','5','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=2401
UPDATE product SET productName = 'قصات فوم ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02401',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2401';
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', '2401', '1.00', '2026-10-22', '5', '0','0240101','500','0','0','500','','0','0','0','0','0','0','0','0','0','0'); -- id=2401
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2401', '1', '0', '5', '2026-10-22'); -- id=3796
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2401', '1', '0', '0', '2401', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16476
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2401, 1,'2026-10-22 10:40:18',5)
                ON DUPLICATE KEY UPDATE productid = 2401, edited = 1, sysdate = '2026-10-22 10:40:18', userid = 5; -- id=3583
UPDATE product SET productName = 'قصات فوم ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02401',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2401';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('قصات عنكبوت ايه ثري ','','122','430','430','0','0','2026-10-22','0','5','0','','0','0','0','0','0','430','430','430','430','430','0','0','0','0','.','0','0','0','430','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','430','430','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','430','0','0','0','0','0','0','','','0','0','0','0'); -- id=2402
UPDATE product SET productName = 'قصات عنكبوت ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '430', productSellAllPrice = '430', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02402',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2402';
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', '2402', '1.00', '2026-10-22', '5', '0','0240201','430','0','0','430','','0','0','0','0','0','0','0','0','0','0'); -- id=2402
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2402', '1', '0', '5', '2026-10-22'); -- id=3797
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '0', '0', '2402', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16477
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2402, 1,'2026-10-22 10:40:18',5)
                ON DUPLICATE KEY UPDATE productid = 2402, edited = 1, sysdate = '2026-10-22 10:40:18', userid = 5; -- id=3584
UPDATE product SET productName = 'قصات عنكبوت ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '430.00', productSellAllPrice = '430.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02402',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '430',meanbuyprice = '430',meanbuyprice_withDiscount = '430' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='430',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2402';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:10:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:40:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:40:20', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17820
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:10:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:40:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:40:20', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17821
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:10:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:40:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:40:44', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17822
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:11:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:41:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:41:00', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17823

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bc48b16bc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:41:00', '06ad9bc48b16bc', '1', '0.00', '0', '0', '1', '15200.00', '15200', '15200', '0', '1', '2026-10-22 10:41:00', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '35' ,'0','','','','','-1','0','0','0','0','0','15200','0','','0','0','15200','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1246
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1246', '0', '2026-10-22 10:41:00', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15200', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:41:00','0','0','',''); -- id=1475
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 1177;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','01979', '1246', '37', '1979', '5', '600', '3000', '0', '', '0', '2026-10-22 10:41:00', '1979', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1177-5,','1','1','0','0','600','3000','0','','0','0.00','0','0','0','0'); -- id=5006
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 290, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5006;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1979, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2900, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2900, 1450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 10:41:00' WHERE storedetailid = '2996';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1979', '1', '5', '1', '1246', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '0', '3', '2026-10-22 10:41:00','0','0'); -- id=16478
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','08984', '1246', '26', '903', '10', '410', '4100', '0', '', '0', '2026-10-22 10:41:00', '903', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','410','4100','0','','0','0.00','0','0','0','0'); -- id=5007
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 5007;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (903, '2026-10-22', 4100, 3900, 3900
                    , 3900, 3900, 3900, 3900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3900, 3900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4100, 3900, 3900
                    , 3900, 3900, 3900, 3900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3900, 3900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '3', storedetaildate = '2026-10-22 10:41:00' WHERE storedetailid = '903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('903', '1', '10', '1', '1246', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '20', '3', '2026-10-22 10:41:00','0','0'); -- id=16479
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 6763;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('385','02278', '1246', '32', '2278', '10', '400', '4000', '0', '', '0', '2026-10-22 10:41:00', '2278', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6763-10,','1','1','0','0','400','4000','0','','0','0.00','0','0','0','0'); -- id=5008
UPDATE sellbilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where sellbilldetailid = 5008;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2278, '2026-10-22', 4000, 3850, 3850
                    , 3850, 3850, 3850, 3850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3850, 3850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4000, 3850, 3850
                    , 3850, 3850, 3850, 3850
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3850, 3850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4000, sellCostBuyPrice =sellCostBuyPrice+3850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3850, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3850
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3850
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-22 10:41:00' WHERE storedetailid = '3671';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2278', '1', '10', '1', '1246', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '30', '3', '2026-10-22 10:41:00','0','0'); -- id=16480
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 6762;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395','02277', '1246', '32', '2277', '10', '410', '4100', '0', '', '0', '2026-10-22 10:41:00', '2277', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6762-10,','1','1','0','0','410','4100','0','','0','0.00','0','0','0','0'); -- id=5009
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 5009;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2277, '2026-10-22', 4100, 3950, 3950
                    , 3950, 3950, 3950, 3950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3950, 3950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4100, 3950, 3950
                    , 3950, 3950, 3950, 3950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3950, 3950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4100, sellCostBuyPrice =sellCostBuyPrice+3950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '80', userid = '3', storedetaildate = '2026-10-22 10:41:00' WHERE storedetailid = '3670';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2277', '1', '10', '1', '1246', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '80', '3', '2026-10-22 10:41:00','0','0'); -- id=16481
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7825813.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7810613.5','15200', '0', '2', 'اضافة فاتورة مبيعات', '1246', '7825813.5', '2026-10-22 10:41:00', '3',  'sellbillController.php','1','','0'); -- id=1549
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15200', '15200', '2026-10-22', '3', '0', '0', '2026-10-22 10:41:00','اضافة فاتورة مبيعات رقم 1246','1','0',null,'0','1246','sellbillController.php?do=showDetail&sellbillid=1246'); -- id=4381
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4381', '419', '15200', '','0'); -- id=4500
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7825813', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4381', '143', '15200', '','0'); -- id=4383
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14167365', 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 ( '14600', '14600', '2026-10-22', '3', '0', '0', '2026-10-22 10:41:00','اضافة فاتورة مبيعات رقم 1246 - صرف البضاعة من المخزن','1','0',null,'0','1246','sellbillController.php?do=showDetail&sellbillid=1246'); -- id=4382
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4382', '402', '14600', '','0'); -- id=4501
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13104062.21', 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 ('4382', '382', '14600', '','0'); -- id=4384
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26280384.29', 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='4381,0,4382' where sellbillid=1246;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15200, 14600, 14600
                    , 14600, 14600, 14600, 14600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14600, 13150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15200, sellCostBuyPrice =sellCostBuyPrice+14600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15200, 14600, 14600
                    , 14600, 14600, 14600, 14600
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14600, 13150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15200, sellCostBuyPrice =sellCostBuyPrice+14600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 15200, 14600, 14600
                    , 14600, 14600, 14600, 14600, 14600, 13150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15200, netSellCostBuyPrice = netSellCostBuyPrice+14600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14600
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14600
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+14600
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14600
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bc48b16bc and sellbillId = 1246 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:11:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:41:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:41:01', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17824
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:11:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:41:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:41:19', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17825
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 ('06ad9bde4408e2', '2026-10-22 10:40:20', '121', '119938.00', '138865', '10', '1', '21030.00',  '18927.00', '0', '18927', '1', '2026-10-22 10:41:19', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=324
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 ('02401', '324', '122', '2401', '24', '500', '12000.00', '0', '', '2026-10-22 10:41:19', '2401','','','0','0','0','0','0',null,'500','12000','0','0','0','0','0','0','0','0','1'); -- id=1745
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:40:20', 1, 2401, 0, 0
                    , 450, 24, 0, 0, 5, '2026-10-22 10:41:19')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:41:19' ; -- id=7071
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2401', '500', '24', '0', 'buyBillController.php', '1745', '', '0', '0'); -- id=1291
UPDATE product SET  productBuyPrice = "500" WHERE productId = 2401 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1745 ;
UPDATE product SET productName = 'قصات فوم ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02401',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '450',meanbuyprice = '500',meanbuyprice_withDiscount = '450' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2401';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1745;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 2401;
UPDATE storedetail SET  productquantity = '24', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3796';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2401', '1', '24', '0', '324', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '5', '2026-10-22 10:40:20','0','0'); -- id=16482
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 ('02402', '324', '122', '2402', '21', '430', '9030.00', '0', '', '2026-10-22 10:41:19', '2402','','','0','0','0','0','0',null,'430','9030','0','0','0','0','0','0','0','0','1'); -- id=1746
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:40:20', 1, 2402, 0, 0
                    , 387, 21, 0, 0, 5, '2026-10-22 10:41:19')
                ON DUPLICATE KEY UPDATE buyprice = 387,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:41:19' ; -- id=7072
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2402', '430', '21', '0', 'buyBillController.php', '1746', '', '0', '0'); -- id=1292
UPDATE product SET  productBuyPrice = "430" WHERE productId = 2402 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1746 ;
UPDATE product SET productName = 'قصات عنكبوت ايه ثري ', productDescription = '', productCatId = '122', productBuyPrice = '430.00', productSellAllPrice = '430.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02402',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '430',lastbuyprice_withDiscount = '387',meanbuyprice = '430',meanbuyprice_withDiscount = '387' , productbuypricereal = '430.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='430',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='430',meanbuyprice_withTax='430',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='387',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2402';
UPDATE buybilldetail SET  lastbuyprice = 430 , meanbuyprice = 430, lastbuyprice_withDiscount = 387, meanbuyprice_withDiscount = 387
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where buybilldetailid = 1746;
UPDATE productunit SET proUnitBuyPrice  = 430 * productnumber WHERE productid = 2402;
UPDATE storedetail SET  productquantity = '21', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '21', '0', '324', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '5', '2026-10-22 10:40:20','0','0'); -- id=16483
UPDATE supplier SET  suppliercurrentDebt = '138865',suppliercurrentDebtInCurrency= '138865' , userid = '5', supplierdate = '2026-10-22 10:41:19'   WHERE supplierid = '121';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('121', '119938.00', '18927', '0', 'اضافة فاتورة مشتريات', '324', '138865', '2026-10-22 10:40:20', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','18927','1','119938','18927','138865','0',''); -- id=870
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18927', '18927', '2026-10-22', '5', '0', '0', '2026-10-22 10:41:19','اضافة فاتورة مشتريات رقم 324','1','0',null,'0','324','buyBillController.php?do=details&id=324'); -- id=4383
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4383', '382', '18927', '','0'); -- id=4502
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26299311.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4383', '604', '18927', '','0'); -- id=4385
UPDATE accountstree SET name = 'ايه ثري', customName = 'ايه ثري', customNameEn = 'ايه ثري', nameEn = 'ايه ثري', parent = '81', accountNature = '1', theValue = '138865', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 11:12:01' WHERE id = '604';
update buybill set dailyentryid='4383,0' where buybillid=324;
COMMIT;
UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2401;UPDATE product SET overAllAveragePrice = 387 WHERE productId = 2402;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:11:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:41:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:41:20', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=324'); -- id=17826
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:11:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:41:22", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:41:22', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=324&type=2'); -- id=17827
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:12:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:42:10", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:42:10', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17828

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bde16f384
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bde16f384 and sellbillId = 1247 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:12:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:42:12", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:42:12', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:12:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:42:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:42:26', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=324&type=2'); -- id=17830
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:12:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:42:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:42:28', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17831
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:12:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:42:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:42:45', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17832
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:13:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:43:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:43:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17833
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:13:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:43:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:43:17', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17834
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:13:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:43:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:43:44', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17835
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:13:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:43:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:43:52', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17836
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:14:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:44:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:44:55', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17837
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('جاكيت فرو جاجوار','','194','600','630','0','0','2026-10-22','0','5','0','','0','0','0','0','0','600','600','600','600','600','0','5','0','0','.','0','0','0','600','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','600','600','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','600','0','0','0','0','0','0','','','0','0','0','0'); -- id=2403
UPDATE product SET productName = 'جاكيت فرو جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '600', productSellAllPrice = '630', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02403',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '5' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',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='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2403';
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', '2403', '1.00', '2026-10-22', '5', '0','0240301','630','0','0','600','','0','0','0','0','0','0','0','0','0','0'); -- id=2403
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2403', '1', '0', '5', '2026-10-22'); -- id=3798
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2403', '1', '0', '0', '2403', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16485
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2403, 1,'2026-10-22 10:44:55',5)
                ON DUPLICATE KEY UPDATE productid = 2403, edited = 1, sysdate = '2026-10-22 10:44:55', userid = 5; -- id=3585
UPDATE product SET productName = 'جاكيت فرو جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '600.00', productSellAllPrice = '630.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02403',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '5' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',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='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2403';
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 ('جاكيت قطيفه جاجوار','','194','670','700','0','0','2026-10-22','0','5','0','','0','0','0','0','0','670','670','670','670','670','0','4.48','0','0','.','0','0','0','670','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','670','670','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','670','0','0','0','0','0','0','','','0','0','0','0'); -- id=2404
UPDATE product SET productName = 'جاكيت قطيفه جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '670', productSellAllPrice = '700', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02404',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '670',lastbuyprice_withDiscount = '670',meanbuyprice = '670',meanbuyprice_withDiscount = '670' , productbuypricereal = '670' , buypricereal_precentage = '0' , buytotal_precentage = '4.48' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='670',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='670',meanbuyprice_withTax='670',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='670',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2404';
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', '2404', '1.00', '2026-10-22', '5', '0','0240401','700','0','0','670','','0','0','0','0','0','0','0','0','0','0'); -- id=2404
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2404', '1', '0', '5', '2026-10-22'); -- id=3799
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2404', '1', '0', '0', '2404', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16486
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2404, 1,'2026-10-22 10:44:55',5)
                ON DUPLICATE KEY UPDATE productid = 2404, edited = 1, sysdate = '2026-10-22 10:44:55', userid = 5; -- id=3586
UPDATE product SET productName = 'جاكيت قطيفه جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '670.00', productSellAllPrice = '700.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02404',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '670',lastbuyprice_withDiscount = '670',meanbuyprice = '670',meanbuyprice_withDiscount = '670' , productbuypricereal = '670' , buypricereal_precentage = '0' , buytotal_precentage = '4.48' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='670',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='670',meanbuyprice_withTax='670',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='670',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2404';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:14:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:44:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:44:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17838
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:14:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:44:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:44:57', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:15:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:45:30", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:45:30', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17840
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:16:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:46:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:46:40', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17841
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 ('06ad9bef92f921', '2026-10-22 10:44:57', '160', '57340.00', '89830', '0', '0', '32490.00',  '32490.00', '0', '32490', '1', '2026-10-22 10:46:40', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=325
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 ('02403', '325', '194', '2403', '24', '600', '14400.00', '0', '', '2026-10-22 10:46:40', '2403','','','0','0','0','0','0',null,'600','14400','0','0','0','0','0','0','0','0','1'); -- id=1747
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:44:57', 1, 2403, 0, 0
                    , 600, 24, 0, 0, 5, '2026-10-22 10:46:40')
                ON DUPLICATE KEY UPDATE buyprice = 600,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:46:40' ; -- id=7073
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2403', '600', '24', '0', 'buyBillController.php', '1747', '', '0', '0'); -- id=1293
UPDATE product SET  productBuyPrice = "600" WHERE productId = 2403 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1747 ;
UPDATE product SET productName = 'جاكيت فرو جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '600.00', productSellAllPrice = '630.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02403',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',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='600',meanbuyprice_withTax='600',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='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2403';
UPDATE buybilldetail SET  lastbuyprice = 600 , meanbuyprice = 600, lastbuyprice_withDiscount = 600, meanbuyprice_withDiscount = 600
        , lastbuyprice_withTax = 600, meanbuyprice_withTax = 600, lastbuyprice_withDiscountAndTax = 600
                where buybilldetailid = 1747;
UPDATE productunit SET proUnitBuyPrice  = 600 * productnumber WHERE productid = 2403;
UPDATE storedetail SET  productquantity = '24', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3798';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2403', '1', '24', '0', '325', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '5', '2026-10-22 10:44:57','0','0'); -- id=16487
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 ('02404', '325', '194', '2404', '27', '670', '18090.00', '0', '', '2026-10-22 10:46:40', '2404','','','0','0','0','0','0',null,'670','18090','0','0','0','0','0','0','0','0','1'); -- id=1748
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:44:57', 1, 2404, 0, 0
                    , 670, 27, 0, 0, 5, '2026-10-22 10:46:40')
                ON DUPLICATE KEY UPDATE buyprice = 670,
                        buyQuantity =buyQuantity+27, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:46:40' ; -- id=7074
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2404', '670', '27', '0', 'buyBillController.php', '1748', '', '0', '0'); -- id=1294
UPDATE product SET  productBuyPrice = "670" WHERE productId = 2404 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1748 ;
UPDATE product SET productName = 'جاكيت قطيفه جاجوار', productDescription = '', productCatId = '194', productBuyPrice = '670.00', productSellAllPrice = '700.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02404',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '670',lastbuyprice_withDiscount = '670',meanbuyprice = '670',meanbuyprice_withDiscount = '670' , productbuypricereal = '670.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.48' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='670',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='670',meanbuyprice_withTax='670',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='670',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2404';
UPDATE buybilldetail SET  lastbuyprice = 670 , meanbuyprice = 670, lastbuyprice_withDiscount = 670, meanbuyprice_withDiscount = 670
        , lastbuyprice_withTax = 670, meanbuyprice_withTax = 670, lastbuyprice_withDiscountAndTax = 670
                where buybilldetailid = 1748;
UPDATE productunit SET proUnitBuyPrice  = 670 * productnumber WHERE productid = 2404;
UPDATE storedetail SET  productquantity = '27', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3799';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2404', '1', '27', '0', '325', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '27', '5', '2026-10-22 10:44:57','0','0'); -- id=16488
UPDATE supplier SET  suppliercurrentDebt = '89830',suppliercurrentDebtInCurrency= '89830' , userid = '5', supplierdate = '2026-10-22 10:46:40'   WHERE supplierid = '160';
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 ('160', '57340.00', '32490', '0', 'اضافة فاتورة مشتريات', '325', '89830', '2026-10-22 10:44:57', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','32490','1','57340','32490','89830','0',''); -- id=871
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '32490', '32490', '2026-10-22', '5', '0', '0', '2026-10-22 10:46:40','اضافة فاتورة مشتريات رقم 325','1','0',null,'0','325','buyBillController.php?do=details&id=325'); -- id=4386
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4386', '382', '32490', '','0'); -- id=4505
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26327001.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4386', '643', '32490', '','0'); -- id=4388
UPDATE accountstree SET name = 'جاجوار ( الجوكر ) - مورد', customName = 'جاجوار ( الجوكر ) - مورد', customNameEn = 'جاجوار ( الجوكر ) - مورد', nameEn = 'جاجوار ( الجوكر ) - مورد', parent = '81', accountNature = '1', theValue = '89830', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 18:10:37' WHERE id = '643';
update buybill set dailyentryid='4386,0' where buybillid=325;
COMMIT;
UPDATE product SET overAllAveragePrice = 600 WHERE productId = 2403;UPDATE product SET overAllAveragePrice = 670 WHERE productId = 2404;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:16:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:46:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:46:41', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=325'); -- id=17842
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:16:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:46:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:46:43', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=325&type=2'); -- id=17843
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:17:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:47:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:47:06', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17844
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 5513 سولدر','','210','345','345','0','0','2026-10-22','0','7','0','','0','0','0','0','0','345','345','345','345','345','0','0','0','0','.','0','0','0','345','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','345','345','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','345','0','0','0','0','0','0','','','0','0','0','0'); -- id=2405
UPDATE product SET productName = 'موديل 5513 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '345', productSellAllPrice = '345', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02405',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2405';
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', '2405', '1.00', '2026-10-22', '7', '0','0240501','345','0','0','345','','0','0','0','0','0','0','0','0','0','0'); -- id=2405
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2405', '1', '0', '7', '2026-10-22'); -- id=3800
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2405', '1', '0', '0', '2405', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16489
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2405, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2405, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3587
UPDATE product SET productName = 'موديل 5513 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '345.00', productSellAllPrice = '345.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02405',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2405';
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 ('موديل 5519 سولدر','','210','445','445','0','0','2026-10-22','0','7','0','','0','0','0','0','0','445','445','445','445','445','0','0','0','0','.','0','0','0','445','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','445','445','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','445','0','0','0','0','0','0','','','0','0','0','0'); -- id=2406
UPDATE product SET productName = 'موديل 5519 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '445', productSellAllPrice = '445', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02406',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2406';
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', '2406', '1.00', '2026-10-22', '7', '0','0240601','445','0','0','445','','0','0','0','0','0','0','0','0','0','0'); -- id=2406
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2406', '1', '0', '7', '2026-10-22'); -- id=3801
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2406', '1', '0', '0', '2406', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16490
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2406, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2406, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3588
UPDATE product SET productName = 'موديل 5519 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '445.00', productSellAllPrice = '445.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02406',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2406';
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 ('موديل 5521سولدر','','210','480','480','0','0','2026-10-22','0','7','0','','0','0','0','0','0','480','480','480','480','480','0','0','0','0','.','0','0','0','480','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','480','480','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','480','0','0','0','0','0','0','','','0','0','0','0'); -- id=2407
UPDATE product SET productName = 'موديل 5521سولدر', productDescription = '', productCatId = '210', productBuyPrice = '480', productSellAllPrice = '480', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02407',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2407';
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', '2407', '1.00', '2026-10-22', '7', '0','0240701','480','0','0','480','','0','0','0','0','0','0','0','0','0','0'); -- id=2407
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2407', '1', '0', '7', '2026-10-22'); -- id=3802
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2407', '1', '0', '0', '2407', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16491
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2407, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2407, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3589
UPDATE product SET productName = 'موديل 5521سولدر', productDescription = '', productCatId = '210', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02407',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2407';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 450 سولدر','','210','450','450','0','0','2026-10-22','0','7','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2408
UPDATE product SET productName = 'موديل 450 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02408',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2408';
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', '2408', '1.00', '2026-10-22', '7', '0','0240801','450','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2408
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2408', '1', '0', '7', '2026-10-22'); -- id=3803
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2408', '1', '0', '0', '2408', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16492
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2408, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2408, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3590
UPDATE product SET productName = 'موديل 450 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02408',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2408';
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 ('موديلات 470 سولدر','','210','470','470','0','0','2026-10-22','0','7','0','','0','0','0','0','0','470','470','470','470','470','0','0','0','0','.','0','0','0','470','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','470','470','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','470','0','0','0','0','0','0','','','0','0','0','0'); -- id=2409
UPDATE product SET productName = 'موديلات 470 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2409';
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', '2409', '1.00', '2026-10-22', '7', '0','0240901','470','0','0','470','','0','0','0','0','0','0','0','0','0','0'); -- id=2409
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2409', '1', '0', '7', '2026-10-22'); -- id=3804
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '0', '0', '2409', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16493
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2409, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2409, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3591
UPDATE product SET productName = 'موديلات 470 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2409';
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 ('موديل 5520 سولدر','','210','520','520','0','0','2026-10-22','0','7','0','','0','0','0','0','0','520','520','520','520','520','0','0','0','0','.','0','0','0','520','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','520','520','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','520','0','0','0','0','0','0','','','0','0','0','0'); -- id=2410
UPDATE product SET productName = 'موديل 5520 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '520', productSellAllPrice = '520', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02410',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2410';
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', '2410', '1.00', '2026-10-22', '7', '0','0241001','520','0','0','520','','0','0','0','0','0','0','0','0','0','0'); -- id=2410
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2410', '1', '0', '7', '2026-10-22'); -- id=3805
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2410', '1', '0', '0', '2410', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16494
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2410, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2410, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3592
UPDATE product SET productName = 'موديل 5520 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02410',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2410';
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 ('موديل 5505 سولدر','','210','500','500','0','0','2026-10-22','0','7','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=2411
UPDATE product SET productName = 'موديل 5505 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02411',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2411';
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', '2411', '1.00', '2026-10-22', '7', '0','0241101','500','0','0','500','','0','0','0','0','0','0','0','0','0','0'); -- id=2411
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2411', '1', '0', '7', '2026-10-22'); -- id=3806
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2411', '1', '0', '0', '2411', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16495
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2411, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2411, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3593
UPDATE product SET productName = 'موديل 5505 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02411',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2411';
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 ('موديل 5512 سولدر','','210','460','460','0','0','2026-10-22','0','7','0','','0','0','0','0','0','460','460','460','460','460','0','0','0','0','.','0','0','0','460','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','460','460','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','460','0','0','0','0','0','0','','','0','0','0','0'); -- id=2412
UPDATE product SET productName = 'موديل 5512 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '460', productSellAllPrice = '460', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02412',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2412';
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', '2412', '1.00', '2026-10-22', '7', '0','0241201','460','0','0','460','','0','0','0','0','0','0','0','0','0','0'); -- id=2412
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2412', '1', '0', '7', '2026-10-22'); -- id=3807
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2412', '1', '0', '0', '2412', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16496
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2412, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2412, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3594
UPDATE product SET productName = 'موديل 5512 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02412',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2412';
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 ('موديل 5510 سولدر','','210','470','470','0','0','2026-10-22','0','7','0','','0','0','0','0','0','470','470','470','470','470','0','0','0','0','.','0','0','0','470','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','470','470','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','470','0','0','0','0','0','0','','','0','0','0','0'); -- id=2413
UPDATE product SET productName = 'موديل 5510 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02413',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2413';
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', '2413', '1.00', '2026-10-22', '7', '0','0241301','470','0','0','470','','0','0','0','0','0','0','0','0','0','0'); -- id=2413
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2413', '1', '0', '7', '2026-10-22'); -- id=3808
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2413', '1', '0', '0', '2413', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16497
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2413, 1,'2026-10-22 10:47:06',7)
                ON DUPLICATE KEY UPDATE productid = 2413, edited = 1, sysdate = '2026-10-22 10:47:06', userid = 7; -- id=3595
UPDATE product SET productName = 'موديل 5510 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02413',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '470',meanbuyprice = '470',meanbuyprice_withDiscount = '470' , productbuypricereal = '470' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='470',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2413';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:17:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:47:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:47:16', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17845
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('سولدر', '', '', '', '', '0', '7', '2026-10-22 10:47:29', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=204
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 ('204', '0', '', '0', 'إضافة مورد جديد', '204', '', '2026-10-22 10:47:29', '7', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=872
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('سولدر', 'سولدر', 'سولدر', 'سولدر', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '7', '0', '2026-10-22 10:47:29'); -- id=691
UPDATE supplier SET suppliername = 'سولدر', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '7', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='691',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '204';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:48:07', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=325&type=2'); -- id=17846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:48:15', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17847
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:48:27', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17848
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:36", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:48:36', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17849
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:48:55', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:18:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:48:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:48:56', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17851
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:19:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:49:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:49:37', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=17852
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 850 انيرجي','','156','850','850','0','0','2026-10-22','0','5','0','','0','0','0','0','0','850','850','850','850','850','0','0','0','0','.','0','0','0','850','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','850','850','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','850','0','0','0','0','0','0','','','0','0','0','0'); -- id=2414
UPDATE product SET productName = 'موديل 850 انيرجي', productDescription = '', productCatId = '156', productBuyPrice = '850', productSellAllPrice = '850', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02414',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',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='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2414';
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', '2414', '1.00', '2026-10-22', '5', '0','0241401','850','0','0','850','','0','0','0','0','0','0','0','0','0','0'); -- id=2414
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2414', '1', '0', '5', '2026-10-22'); -- id=3809
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2414', '1', '0', '0', '2414', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16498
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2414, 1,'2026-10-22 10:49:37',5)
                ON DUPLICATE KEY UPDATE productid = 2414, edited = 1, sysdate = '2026-10-22 10:49:37', userid = 5; -- id=3596
UPDATE product SET productName = 'موديل 850 انيرجي', productDescription = '', productCatId = '156', productBuyPrice = '850.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02414',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',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='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2414';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:19:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:49:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:49:39', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17853
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:19:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:49:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:49:40', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17854
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:20:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:50:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:50:34', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17855
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 ('06ad9c014c825b', '2026-10-22 10:49:40', '171', '90712.00', '125120', '8', '1', '37400.00',  '34408.00', '0', '34408', '1', '2026-10-22 10:50:34', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=326
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 ('02414', '326', '156', '2414', '44', '850', '37400.00', '0', '', '2026-10-22 10:50:34', '2414','','','0','0','0','0','0',null,'850','37400','0','0','0','0','0','0','0','0','1'); -- id=1749
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:49:40', 1, 2414, 0, 0
                    , 782, 44, 0, 0, 5, '2026-10-22 10:50:34')
                ON DUPLICATE KEY UPDATE buyprice = 782,
                        buyQuantity =buyQuantity+44, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 10:50:34' ; -- id=7075
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2414', '850', '44', '0', 'buyBillController.php', '1749', '', '0', '0'); -- id=1295
UPDATE product SET  productBuyPrice = "850" WHERE productId = 2414 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1749 ;
UPDATE product SET productName = 'موديل 850 انيرجي', productDescription = '', productCatId = '156', productBuyPrice = '850.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02414',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '782',meanbuyprice = '850',meanbuyprice_withDiscount = '782' , productbuypricereal = '850.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='850',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='850',meanbuyprice_withTax='850',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='782',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2414';
UPDATE buybilldetail SET  lastbuyprice = 850 , meanbuyprice = 850, lastbuyprice_withDiscount = 782, meanbuyprice_withDiscount = 782
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 782
                where buybilldetailid = 1749;
UPDATE productunit SET proUnitBuyPrice  = 850 * productnumber WHERE productid = 2414;
UPDATE storedetail SET  productquantity = '44', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2414', '1', '44', '0', '326', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '44', '5', '2026-10-22 10:49:40','0','0'); -- id=16499
UPDATE supplier SET  suppliercurrentDebt = '125120',suppliercurrentDebtInCurrency= '125120' , userid = '5', supplierdate = '2026-10-22 10:50:34'   WHERE supplierid = '171';
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 ('171', '90712.00', '34408', '0', 'اضافة فاتورة مشتريات', '326', '125120', '2026-10-22 10:49:40', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','34408','1','90712','34408','125120','0',''); -- id=873
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '34408', '34408', '2026-10-22', '5', '0', '0', '2026-10-22 10:50:34','اضافة فاتورة مشتريات رقم 326','1','0',null,'0','326','buyBillController.php?do=details&id=326'); -- id=4387
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4387', '382', '34408', '','0'); -- id=4506
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26361409.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4387', '654', '34408', '','0'); -- id=4389
UPDATE accountstree SET name = 'انيرجي', customName = 'انيرجي', customNameEn = 'انيرجي', nameEn = 'انيرجي', parent = '81', accountNature = '1', theValue = '125120', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 12:48:25' WHERE id = '654';
update buybill set dailyentryid='4387,0' where buybillid=326;
COMMIT;
UPDATE product SET overAllAveragePrice = 782 WHERE productId = 2414;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:20:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:50:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:50:34', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=326'); -- id=17856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:20:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:50:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:50:41', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=326&type=2'); -- id=17857
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:20:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:50:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:50:53', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=17858
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 ('06ad9bf84bd731', '2026-10-22 10:47:16', '204', '0.00', '306872.1', '7', '1', '329970.00',  '306872.10', '0', '306872.1', '1', '2026-10-22 10:50:53', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=327
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 ('02405', '327', '210', '2405', '60', '345', '20700.00', '0', '', '2026-10-22 10:50:53', '2405','','','0','0','0','0','0',null,'345','20700','0','0','0','0','0','0','0','0','1'); -- id=1750
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2405, 0, 0
                    , 320.85, 60, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 320.85,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7076
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2405', '345', '60', '0', 'buyBillController.php', '1750', '', '0', '0'); -- id=1296
UPDATE product SET  productBuyPrice = "345" WHERE productId = 2405 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1750 ;
UPDATE product SET productName = 'موديل 5513 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '345.00', productSellAllPrice = '345.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02405',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '320.85',meanbuyprice = '345',meanbuyprice_withDiscount = '320.85' , productbuypricereal = '345.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='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='320.85',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2405';
UPDATE buybilldetail SET  lastbuyprice = 345 , meanbuyprice = 345, lastbuyprice_withDiscount = 320.85, meanbuyprice_withDiscount = 320.85
        , lastbuyprice_withTax = 345, meanbuyprice_withTax = 345, lastbuyprice_withDiscountAndTax = 320.85
                where buybilldetailid = 1750;
UPDATE productunit SET proUnitBuyPrice  = 345 * productnumber WHERE productid = 2405;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3800';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2405', '1', '60', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '7', '2026-10-22 10:47:16','0','0'); -- id=16500
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 ('02406', '327', '210', '2406', '72', '445', '32040.00', '0', '', '2026-10-22 10:50:53', '2406','','','0','0','0','0','0',null,'445','32040','0','0','0','0','0','0','0','0','1'); -- id=1751
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2406, 0, 0
                    , 413.85, 72, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 413.85,
                        buyQuantity =buyQuantity+72, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7077
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2406', '445', '72', '0', 'buyBillController.php', '1751', '', '0', '0'); -- id=1297
UPDATE product SET  productBuyPrice = "445" WHERE productId = 2406 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1751 ;
UPDATE product SET productName = 'موديل 5519 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '445.00', productSellAllPrice = '445.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02406',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '413.85',meanbuyprice = '445',meanbuyprice_withDiscount = '413.85' , productbuypricereal = '445.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='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='413.85',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2406';
UPDATE buybilldetail SET  lastbuyprice = 445 , meanbuyprice = 445, lastbuyprice_withDiscount = 413.85, meanbuyprice_withDiscount = 413.85
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 413.85
                where buybilldetailid = 1751;
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 2406;
UPDATE storedetail SET  productquantity = '72', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3801';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2406', '1', '72', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '72', '7', '2026-10-22 10:47:16','0','0'); -- id=16501
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 ('02407', '327', '210', '2407', '48', '480', '23040.00', '0', '', '2026-10-22 10:50:53', '2407','','','0','0','0','0','0',null,'480','23040','0','0','0','0','0','0','0','0','1'); -- id=1752
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2407, 0, 0
                    , 446.4, 48, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 446.4,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7078
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2407', '480', '48', '0', 'buyBillController.php', '1752', '', '0', '0'); -- id=1298
UPDATE product SET  productBuyPrice = "480" WHERE productId = 2407 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1752 ;
UPDATE product SET productName = 'موديل 5521سولدر', productDescription = '', productCatId = '210', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02407',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '446.4',meanbuyprice = '480',meanbuyprice_withDiscount = '446.4' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='446.4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2407';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 446.4, meanbuyprice_withDiscount = 446.4
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 446.4
                where buybilldetailid = 1752;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 2407;
UPDATE storedetail SET  productquantity = '48', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3802';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2407', '1', '48', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '7', '2026-10-22 10:47:16','0','0'); -- id=16502
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 ('02408', '327', '210', '2408', '45', '450', '20250.00', '0', '', '2026-10-22 10:50:53', '2408','','','0','0','0','0','0',null,'450','20250','0','0','0','0','0','0','0','0','1'); -- id=1753
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2408, 0, 0
                    , 418.5, 45, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 418.5,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7079
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2408', '450', '45', '0', 'buyBillController.php', '1753', '', '0', '0'); -- id=1299
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2408 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1753 ;
UPDATE product SET productName = 'موديل 450 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02408',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '418.5',meanbuyprice = '450',meanbuyprice_withDiscount = '418.5' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='418.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2408';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 418.5, meanbuyprice_withDiscount = 418.5
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where buybilldetailid = 1753;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2408;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2408', '1', '45', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 10:47:16','0','0'); -- id=16503
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 ('02409', '327', '210', '2409', '18', '470', '8460.00', '0', '', '2026-10-22 10:50:53', '2409','','','0','0','0','0','0',null,'470','8460','0','0','0','0','0','0','0','0','1'); -- id=1754
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2409, 0, 0
                    , 437.1, 18, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 437.1,
                        buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7080
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2409', '470', '18', '0', 'buyBillController.php', '1754', '', '0', '0'); -- id=1300
UPDATE product SET  productBuyPrice = "470" WHERE productId = 2409 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1754 ;
UPDATE product SET productName = 'موديلات 470 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '437.1',meanbuyprice = '470',meanbuyprice_withDiscount = '437.1' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='437.1',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2409';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 437.1, meanbuyprice_withDiscount = 437.1
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where buybilldetailid = 1754;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 2409;
UPDATE storedetail SET  productquantity = '18', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '18', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '18', '7', '2026-10-22 10:47:16','0','0'); -- id=16504
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 ('02409', '327', '210', '2409', '60', '470', '28200.00', '0', '', '2026-10-22 10:50:53', '2409','','','0','0','0','0','0',null,'470','28200','0','0','0','0','0','0','0','0','1'); -- id=1755
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2409, 0, 0
                    , 437.1, 60, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 437.1,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7080
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2409', '470', '60', '0', 'buyBillController.php', '1755', '', '0', '0'); -- id=1301
UPDATE product SET  productBuyPrice = "470" WHERE productId = 2409 ;
UPDATE buybilldetail SET  quantitybefore = 18 WHERE buybilldetailid = 1755 ;
UPDATE product SET productName = 'موديلات 470 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '437.1',meanbuyprice = '470',meanbuyprice_withDiscount = '437.1' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='437.1',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2409';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 437.1, meanbuyprice_withDiscount = 437.1
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where buybilldetailid = 1755;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 2409;
UPDATE storedetail SET  productquantity = '78', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '60', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '18', '78', '7', '2026-10-22 10:47:16','0','0'); -- id=16505
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 ('02410', '327', '210', '2410', '90', '520', '46800.00', '0', '', '2026-10-22 10:50:53', '2410','','','0','0','0','0','0',null,'520','46800','0','0','0','0','0','0','0','0','1'); -- id=1756
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2410, 0, 0
                    , 483.6, 90, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 483.6,
                        buyQuantity =buyQuantity+90, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7082
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2410', '520', '90', '0', 'buyBillController.php', '1756', '', '0', '0'); -- id=1302
UPDATE product SET  productBuyPrice = "520" WHERE productId = 2410 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1756 ;
UPDATE product SET productName = 'موديل 5520 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02410',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '483.6',meanbuyprice = '520',meanbuyprice_withDiscount = '483.6' , productbuypricereal = '520.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='483.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2410';
UPDATE buybilldetail SET  lastbuyprice = 520 , meanbuyprice = 520, lastbuyprice_withDiscount = 483.6, meanbuyprice_withDiscount = 483.6
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 483.6
                where buybilldetailid = 1756;
UPDATE productunit SET proUnitBuyPrice  = 520 * productnumber WHERE productid = 2410;
UPDATE storedetail SET  productquantity = '90', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3805';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2410', '1', '90', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '90', '7', '2026-10-22 10:47:16','0','0'); -- id=16506
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 ('02411', '327', '210', '2411', '72', '500', '36000.00', '0', '', '2026-10-22 10:50:53', '2411','','','0','0','0','0','0',null,'500','36000','0','0','0','0','0','0','0','0','1'); -- id=1757
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2411, 0, 0
                    , 465, 72, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 465,
                        buyQuantity =buyQuantity+72, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7083
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2411', '500', '72', '0', 'buyBillController.php', '1757', '', '0', '0'); -- id=1303
UPDATE product SET  productBuyPrice = "500" WHERE productId = 2411 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1757 ;
UPDATE product SET productName = 'موديل 5505 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02411',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '465',meanbuyprice = '500',meanbuyprice_withDiscount = '465' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='465',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2411';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 465, meanbuyprice_withDiscount = 465
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 465
                where buybilldetailid = 1757;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 2411;
UPDATE storedetail SET  productquantity = '72', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2411', '1', '72', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '72', '7', '2026-10-22 10:47:16','0','0'); -- id=16507
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 ('02412', '327', '210', '2412', '75', '460', '34500.00', '0', '', '2026-10-22 10:50:53', '2412','','','0','0','0','0','0',null,'460','34500','0','0','0','0','0','0','0','0','1'); -- id=1758
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2412, 0, 0
                    , 427.8, 75, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 427.8,
                        buyQuantity =buyQuantity+75, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7084
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2412', '460', '75', '0', 'buyBillController.php', '1758', '', '0', '0'); -- id=1304
UPDATE product SET  productBuyPrice = "460" WHERE productId = 2412 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1758 ;
UPDATE product SET productName = 'موديل 5512 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02412',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '427.8',meanbuyprice = '460',meanbuyprice_withDiscount = '427.8' , productbuypricereal = '460.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='427.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2412';
UPDATE buybilldetail SET  lastbuyprice = 460 , meanbuyprice = 460, lastbuyprice_withDiscount = 427.8, meanbuyprice_withDiscount = 427.8
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 427.8
                where buybilldetailid = 1758;
UPDATE productunit SET proUnitBuyPrice  = 460 * productnumber WHERE productid = 2412;
UPDATE storedetail SET  productquantity = '75', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2412', '1', '75', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '75', '7', '2026-10-22 10:47:16','0','0'); -- id=16508
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 ('02409', '327', '210', '2409', '84', '470', '39480.00', '0', '', '2026-10-22 10:50:53', '2409','','','0','0','0','0','0',null,'470','39480','0','0','0','0','0','0','0','0','1'); -- id=1759
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2409, 0, 0
                    , 437.1, 84, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 437.1,
                        buyQuantity =buyQuantity+84, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7080
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2409', '470', '84', '0', 'buyBillController.php', '1759', '', '0', '0'); -- id=1305
UPDATE product SET  productBuyPrice = "470" WHERE productId = 2409 ;
UPDATE buybilldetail SET  quantitybefore = 78 WHERE buybilldetailid = 1759 ;
UPDATE product SET productName = 'موديلات 470 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '470.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02409',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '470',lastbuyprice_withDiscount = '437.1',meanbuyprice = '470',meanbuyprice_withDiscount = '437.1' , productbuypricereal = '470.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='470',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='470',meanbuyprice_withTax='470',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='437.1',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2409';
UPDATE buybilldetail SET  lastbuyprice = 470 , meanbuyprice = 470, lastbuyprice_withDiscount = 437.1, meanbuyprice_withDiscount = 437.1
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where buybilldetailid = 1759;
UPDATE productunit SET proUnitBuyPrice  = 470 * productnumber WHERE productid = 2409;
UPDATE storedetail SET  productquantity = '162', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '84', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '78', '162', '7', '2026-10-22 10:47:16','0','0'); -- id=16509
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 ('02408', '327', '210', '2408', '90', '450', '40500.00', '0', '', '2026-10-22 10:50:53', '2408','','','0','0','0','0','0',null,'450','40500','0','0','0','0','0','0','0','0','1'); -- id=1760
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 10:47:16', 1, 2408, 0, 0
                    , 418.5, 90, 0, 0, 7, '2026-10-22 10:50:53')
                ON DUPLICATE KEY UPDATE buyprice = 418.5,
                        buyQuantity =buyQuantity+90, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 10:50:53' ; -- id=7079
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2408', '450', '90', '0', 'buyBillController.php', '1760', '', '0', '0'); -- id=1306
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2408 ;
UPDATE buybilldetail SET  quantitybefore = 45 WHERE buybilldetailid = 1760 ;
UPDATE product SET productName = 'موديل 450 سولدر', productDescription = '', productCatId = '210', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02408',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '418.5',meanbuyprice = '450',meanbuyprice_withDiscount = '418.5' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='418.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2408';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 418.5, meanbuyprice_withDiscount = 418.5
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where buybilldetailid = 1760;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2408;
UPDATE storedetail SET  productquantity = '135', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2408', '1', '90', '0', '327', 'اضافة فاتورة مشتريات', 'buyBillController.php', '45', '135', '7', '2026-10-22 10:47:16','0','0'); -- id=16510
UPDATE supplier SET  suppliercurrentDebt = '306872.1',suppliercurrentDebtInCurrency= '306872.1' , userid = '7', supplierdate = '2026-10-22 10:50:53'   WHERE supplierid = '204';
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 ('204', '0.00', '306872.1', '0', 'اضافة فاتورة مشتريات', '327', '306872.1', '2026-10-22 10:47:16', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','306872.1','1','0','306872.1','306872.1','0',''); -- id=874
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '306872.1', '306872.1', '2026-10-22', '7', '0', '0', '2026-10-22 10:50:53','اضافة فاتورة مشتريات رقم 327','1','0',null,'0','327','buyBillController.php?do=details&id=327'); -- id=4388
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4388', '382', '306872.1', '','0'); -- id=4507
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26668281.39', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4388', '691', '306872.1', '','0'); -- id=4390
UPDATE accountstree SET name = 'سولدر', customName = 'سولدر', customNameEn = 'سولدر', nameEn = 'سولدر', parent = '81', accountNature = '1', theValue = '306872.1', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 10:47:29' WHERE id = '691';
update buybill set dailyentryid='4388,0' where buybillid=327;
COMMIT;
UPDATE product SET overAllAveragePrice = 320.85 WHERE productId = 2405;UPDATE product SET overAllAveragePrice = 413.85 WHERE productId = 2406;UPDATE product SET overAllAveragePrice = 446.4 WHERE productId = 2407;UPDATE product SET overAllAveragePrice = 418.5 WHERE productId = 2408;UPDATE product SET overAllAveragePrice = 437.1 WHERE productId = 2409;UPDATE product SET overAllAveragePrice = 483.6 WHERE productId = 2410;UPDATE product SET overAllAveragePrice = 465 WHERE productId = 2411;UPDATE product SET overAllAveragePrice = 427.8 WHERE productId = 2412;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:20:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:50:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:50:53', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=327'); -- id=17859
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:00', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2'); -- id=17860
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:51:37', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17861
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:39', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=326&type=2'); -- id=17862
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:51:39', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17863
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:41', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=326'); -- id=17864
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:47', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17865
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17866
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:50', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17867
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:52', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:53', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=325&type=2'); -- id=17869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:53', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=325'); -- id=17870
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:54', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17872
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:56', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17873
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:56', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=324&type=2'); -- id=17874
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:56', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=324'); -- id=17875
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:51:56', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17876
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:21:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:51:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:51:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17877
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:22:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:52:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:52:56', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:53:10', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17879
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:53:15', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:53:16', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17881
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:53:16', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:53:20', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17883
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:53:20', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17884
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:23:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:53:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:53:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:54:15', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=17886
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:20', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:20', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=17888
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:31', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:33', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=327'); -- id=17890
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:37', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17891
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:39', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=327'); -- id=17892
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:54:41', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2'); -- id=17893
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:54:49', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=327'); -- id=17894
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:24:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:54:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:54:53', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2'); -- id=17895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:25:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:55:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:55:54', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:25:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:55:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:55:58', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2'); -- id=17897
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:25:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:55:59", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:55:59', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17898
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:56:00', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=327'); -- id=17899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:56:01', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:56:06', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2&parcodeTypeToPrint=1'); -- id=17901
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:56:19', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=327'); -- id=17902
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:56:32', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17903
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 10:56:37', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=17904
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:26:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:56:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:56:55', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17905
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:57:00', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17906

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c0f0a99b1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 10:57:00', '06ad9c0f0a99b1', '1', '0.00', '0', '0', '1', '6810.00', '6810', '6810', '0', '1', '2026-10-22 10:57:00', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','6810','0','','0','0','6810','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1248
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1248', '0', '2026-10-22 10:57:00', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6810', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 10:57:00','0','0','',''); -- id=1477
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1248', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 10:57:00', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5011
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5011;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '371', userid = '3', storedetaildate = '2026-10-22 10:57:00' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1248', 'اضافة فاتورة مبيعات', 'sellbillController.php', '377', '371', '3', '2026-10-22 10:57:00','0','0'); -- id=16511
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1248', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 10:57:00', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5012
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5012;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '404', userid = '3', storedetaildate = '2026-10-22 10:57:00' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1248', 'اضافة فاتورة مبيعات', 'sellbillController.php', '407', '404', '3', '2026-10-22 10:57:00','0','0'); -- id=16512
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1248', '153', '1919', '6', '450', '2700', '0', '', '0', '2026-10-22 10:57:00', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6143-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5013
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5013;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 2700, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '82', userid = '3', storedetaildate = '2026-10-22 10:57:00' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '6', '1', '1248', 'اضافة فاتورة مبيعات', 'sellbillController.php', '88', '82', '3', '2026-10-22 10:57:00','0','0'); -- id=16513
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7832623.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7825813.5','6810', '0', '2', 'اضافة فاتورة مبيعات', '1248', '7832623.5', '2026-10-22 10:57:00', '3',  'sellbillController.php','1','','0'); -- id=1551
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6810', '6810', '2026-10-22', '3', '0', '0', '2026-10-22 10:57:00','اضافة فاتورة مبيعات رقم 1248','1','0',null,'0','1248','sellbillController.php?do=showDetail&sellbillid=1248'); -- id=4389
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4389', '419', '6810', '','0'); -- id=4508
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7832623', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4389', '143', '6810', '','0'); -- id=4391
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14179275', 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 ( '6480', '6480', '2026-10-22', '3', '0', '0', '2026-10-22 10:57:00','اضافة فاتورة مبيعات رقم 1248 - صرف البضاعة من المخزن','1','0',null,'0','1248','sellbillController.php?do=showDetail&sellbillid=1248'); -- id=4390
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4390', '402', '6480', '','0'); -- id=4509
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13115342.21', 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 ('4390', '382', '6480', '','0'); -- id=4392
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26661801.39', 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='4389,0,4390' where sellbillid=1248;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6810, 6480, 6480
                    , 6480, 6480, 6480, 6480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6480, 6480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6810, sellCostBuyPrice =sellCostBuyPrice+6480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6810, 6480, 6480
                    , 6480, 6480, 6480, 6480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6480, 6480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6810, sellCostBuyPrice =sellCostBuyPrice+6480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6810, 6480, 6480
                    , 6480, 6480, 6480, 6480, 6480, 6480)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6810, netSellCostBuyPrice = netSellCostBuyPrice+6480
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6480
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6480
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6480
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6480
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6480
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6480
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6480;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c0f0a99b1 and sellbillId = 1248 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:57:01', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17907
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:57:25', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17908
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 10:57:26', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17909
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:36";
UPDATE user SET loginip = "197.193.5.8", lastactivetime = "2026-10-22 10:57:36", 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 < "2026-10-22 07:27:36";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 10:57:36", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:57:44', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17910
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:57:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:57:44', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17911
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:27:54";
UPDATE user SET loginip = "197.193.5.8", lastactivetime = "2026-10-22 10:57:54", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:28:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:58:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 10:58:11', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=327&type=2'); -- id=17912
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:28:18";
UPDATE user SET loginip = "197.193.5.8", lastactivetime = "2026-10-22 10:58:18", deviceType = "DESKTOP" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:29:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:59:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:59:02', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1248'); -- id=17913
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:29:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:59:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:59:02', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1248'); -- id=17914
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:29:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:59:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:59:05', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17915
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:29:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 10:59:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 10:59:05', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17916
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:30:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:00:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:00:29', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=327'); -- id=17917
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:30:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:00:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:00:33', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17918
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:31:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:01:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:01:39', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17919

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c249a2d17
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c249a2d17 and sellbillId = 1249 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:31:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:01:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:01:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17920
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:33:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:03:10", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:03:10', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17921

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9be5509519
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:03:10', '06ad9be5509519', '1', '0.00', '0', '0', '1', '14005.00', '14005', '14005', '0', '1', '2026-10-22 11:03:10', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','14005','0','','0','0','14005','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1250
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1250', '0', '2026-10-22 11:03:10', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14005', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:03:10','0','0','',''); -- id=1479
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6986;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('480','02350', '1250', '108', '2350', '6', '500', '3000', '0', '', '0', '2026-10-22 11:03:10', '2350', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6986-6,','1','1','0','0','500','3000','0','','0','0.00','0','0','0','0'); -- id=5015
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 480.00, meanbuyprice_withDiscount = 480.00
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 480
                where sellbilldetailid = 5015;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2350, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '6', storedetaildate = '2026-10-22 11:03:10' WHERE storedetailid = '3744';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2350', '1', '6', '1', '1250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '6', '2026-10-22 11:03:10','0','0'); -- id=16515
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1250', '175', '2088', '5', '595', '2975', '0', '', '0', '2026-10-22 11:03:10', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-5,','1','1','0','0','595','2975','0','','0','0.00','0','0','0','0'); -- id=5016
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5016;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '991', userid = '6', storedetaildate = '2026-10-22 11:03:10' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '5', '1', '1250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '996', '991', '6', '2026-10-22 11:03:10','0','0'); -- id=16516
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 892;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('740','01845', '1250', '143', '1845', '4', '770', '3080', '0', '', '0', '2026-10-22 11:03:10', '1845', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','892-4,','1','1','0','0','770','3080','0','','0','0.00','0','0','0','0'); -- id=5017
UPDATE sellbilldetail SET  lastbuyprice = 740.00 , meanbuyprice = 740.00, lastbuyprice_withDiscount = 740.00, meanbuyprice_withDiscount = 740.00
        , lastbuyprice_withTax = 740, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 740
                where sellbilldetailid = 5017;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1845, '2026-10-22', 3080, 2960, 2960
                    , 2960, 2960, 2960, 2960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2960, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3080, sellCostBuyPrice =sellCostBuyPrice+2960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3080, 2960, 2960
                    , 2960, 2960, 2960, 2960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2960, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3080, sellCostBuyPrice =sellCostBuyPrice+2960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '6', storedetaildate = '2026-10-22 11:03:10' WHERE storedetailid = '2862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1845', '1', '4', '1', '1250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '10', '6', '2026-10-22 11:03:10','0','0'); -- id=16517
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 348;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','01503', '1250', '108', '1503', '6', '600', '3600', '0', '', '0', '2026-10-22 11:03:10', '1503', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','348-6,','1','1','0','0','600','3600','0','','0','0.00','0','0','0','0'); -- id=5018
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5018;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1503, '2026-10-22', 3600, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3600, 3480, 3480
                    , 3480, 3480, 3480, 3480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = 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 = '6', storedetaildate = '2026-10-22 11:03:10' WHERE storedetailid = '1528';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1503', '1', '6', '1', '1250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '6', '2026-10-22 11:03:10','0','0'); -- id=16518
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6799;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','02291', '1250', '203', '2291', '3', '450', '1350', '0', '', '0', '2026-10-22 11:03:10', '2291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6799-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5019
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 5019;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2291, '2026-10-22', 1350, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '6', storedetaildate = '2026-10-22 11:03:10' WHERE storedetailid = '3684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2291', '1', '3', '1', '1250', 'اضافة فاتورة مبيعات', 'sellbillController.php', '108', '105', '6', '2026-10-22 11:03:10','0','0'); -- id=16519
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1159685',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1145680','14005', '0', '4', 'اضافة فاتورة مبيعات', '1250', '1159685', '2026-10-22 11:03:10', '6',  'sellbillController.php','1','','0'); -- id=1553
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14005', '14005', '2026-10-22', '6', '0', '0', '2026-10-22 11:03:10','اضافة فاتورة مبيعات رقم 1250','1','0',null,'0','1250','sellbillController.php?do=showDetail&sellbillid=1250'); -- id=4393
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4393', '568', '14005', '','0'); -- id=4512
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1159685', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4393', '143', '14005', '','0'); -- id=4395
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14195980', 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 ( '12880', '12880', '2026-10-22', '6', '0', '0', '2026-10-22 11:03:10','اضافة فاتورة مبيعات رقم 1250 - صرف البضاعة من المخزن','1','0',null,'0','1250','sellbillController.php?do=showDetail&sellbillid=1250'); -- id=4394
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4394', '402', '12880', '','0'); -- id=4513
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13130772.21', 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 ('4394', '382', '12880', '','0'); -- id=4396
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26646371.39', 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='4393,0,4394' where sellbillid=1250;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 14005, 12880, 12880
                    , 12880, 12880, 12880, 12880
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12880, 11400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14005, sellCostBuyPrice =sellCostBuyPrice+12880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 14005, 12880, 12880
                    , 12880, 12880, 12880, 12880
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12880, 11400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14005, sellCostBuyPrice =sellCostBuyPrice+12880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 14005, 12880, 12880
                    , 12880, 12880, 12880, 12880, 12880, 11400)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14005, netSellCostBuyPrice = netSellCostBuyPrice+12880
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12880
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12880
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12880
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12880
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12880
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12880
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+11400;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9be5509519 and sellbillId = 1250 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:33:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:03:10", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:03:10', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17922
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:36:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:06:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:06:26', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17923
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:37:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:07:55", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:07:55', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17924

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c33ea7b23
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c33ea7b23 and sellbillId = 1251 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c45c2813c
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c45c2813c and sellbillId = 1252 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:41:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:11:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:11:04', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17927
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:42:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:12:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:12:45', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17928

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c51820024
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:12:45', '06ad9c51820024', '1', '0.00', '0', '0', '1', '2145.00', '2145', '2145', '0', '1', '2026-10-22 11:12:45', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','2145','0','','0','0','2145','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1253
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1253', '0', '2026-10-22 11:12:45', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '2145', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:12:45','0','0','',''); -- id=1482
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6707;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02252', '1253', '191', '2252', '3', '370', '1110', '0', '', '0', '2026-10-22 11:12:45', '2252', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6707-3,','1','1','0','0','370','1110','0','','0','0.00','0','0','0','0'); -- id=5023
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5023;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2252, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '92', userid = '6', storedetaildate = '2026-10-22 11:12:45' WHERE storedetailid = '3643';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2252', '1', '3', '1', '1253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '95', '92', '6', '2026-10-22 11:12:45','0','0'); -- id=16523
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6479;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('280','02203', '1253', '191', '2203', '3', '345', '1035', '0', '', '0', '2026-10-22 11:12:45', '2203', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6479-3,','1','1','0','0','345','1035','0','','0','0.00','0','0','0','0'); -- id=5024
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 280
                where sellbilldetailid = 5024;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2203, '2026-10-22', 1035, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1035, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '6', storedetaildate = '2026-10-22 11:12:45' WHERE storedetailid = '3592';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2203', '1', '3', '1', '1253', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '6', '2026-10-22 11:12:45','0','0'); -- id=16524
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1169375',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1167230','2145', '0', '4', 'اضافة فاتورة مبيعات', '1253', '1169375', '2026-10-22 11:12:45', '6',  'sellbillController.php','1','','0'); -- id=1556
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '2145', '2145', '2026-10-22', '6', '0', '0', '2026-10-22 11:12:45','اضافة فاتورة مبيعات رقم 1253','1','0',null,'0','1253','sellbillController.php?do=showDetail&sellbillid=1253'); -- id=4399
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4399', '568', '2145', '','0'); -- id=4518
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1169375', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4399', '143', '2145', '','0'); -- id=4401
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14205670', 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 ( '1740', '1740', '2026-10-22', '6', '0', '0', '2026-10-22 11:12:45','اضافة فاتورة مبيعات رقم 1253 - صرف البضاعة من المخزن','1','0',null,'0','1253','sellbillController.php?do=showDetail&sellbillid=1253'); -- id=4400
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4400', '402', '1740', '','0'); -- id=4519
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13139292.21', 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 ('4400', '382', '1740', '','0'); -- id=4402
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26637851.39', 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='4399,0,4400' where sellbillid=1253;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 2145, 1740, 1740
                    , 1740, 1740, 1740, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1740, 1740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2145, sellCostBuyPrice =sellCostBuyPrice+1740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2145, 1740, 1740
                    , 1740, 1740, 1740, 1740
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,1740, 1740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2145, sellCostBuyPrice =sellCostBuyPrice+1740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1740, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1740
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1740
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 2145, 1740, 1740
                    , 1740, 1740, 1740, 1740, 1740, 1740)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+2145, netSellCostBuyPrice = netSellCostBuyPrice+1740
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1740
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1740
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1740
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1740
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+1740
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+1740
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+1740;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c51820024 and sellbillId = 1253 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:42:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:12:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:12:45', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17929
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:42:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:12:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:12:47', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17930
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:42:47";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:12:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:12:47', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17931
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:42:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:12:50", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:12:50', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17932
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:43:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:13:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:13:00', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17933

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c18fce465
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:13:00', '06ad9c18fce465', '1', '0.00', '0', '0', '1', '58545.00', '58545', '58545', '0', '1', '2026-10-22 11:13:00', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '149' ,'0','','','','','-1','0','0','0','0','0','58545','0','','0','0','58545','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1254
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1254', '0', '2026-10-22 11:13:00', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '58545', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:13:00','0','0','',''); -- id=1483
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1254', '147', '2359', '12', '425', '5100', '0', '', '0', '2026-10-22 11:13:00', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-12,','1','1','0','0','425','5100','0','','0','0.00','0','0','0','0'); -- id=5025
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5025;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 5100, 4728, 4728
                    , 4728, 4728, 4728, 4728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4728, 4728, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5100, sellCostBuyPrice =sellCostBuyPrice+4728
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4728, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4728
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4728
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4728
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5100, 4728, 4728
                    , 4728, 4728, 4728, 4728
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4728, 4728, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5100, sellCostBuyPrice =sellCostBuyPrice+4728
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4728, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4728
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4728, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4728
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4728
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4728
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4728
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '12', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '63', '51', '2', '2026-10-22 11:13:00','0','0'); -- id=16525
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1254', '207', '2380', '12', '450', '5400', '0', '', '0', '2026-10-22 11:13:00', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-12,','1','1','0','0','450','5400','0','','0','0.00','0','0','0','0'); -- id=5026
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5026;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 5400, 5160, 5160
                    , 5160, 5160, 5160, 5160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5160, 5160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5400, 5160, 5160
                    , 5160, 5160, 5160, 5160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5160, 5160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '359', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '12', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '371', '359', '2', '2026-10-22 11:13:00','0','0'); -- id=16526
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1254', '153', '1921', '6', '485', '2910', '0', '', '0', '2026-10-22 11:13:00', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-6,','1','1','0','0','485','2910','0','','0','0.00','0','0','0','0'); -- id=5027
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5027;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 2910, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2910, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2910, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2910, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '122', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '6', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '128', '122', '2', '2026-10-22 11:13:00','0','0'); -- id=16527
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6143;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+2 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1254', '153', '1919', '6', '450', '2700', '0', '', '0', '2026-10-22 11:13:00', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6143-4,7028-2,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5028
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5028;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 2700, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '6', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '76', '70', '2', '2026-10-22 11:13:00','0','0'); -- id=16528
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6765;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1254', '147', '1886', '12', '320', '3840', '0', '', '0', '2026-10-22 11:13:00', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5029
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5029;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '112', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '12', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '124', '112', '2', '2026-10-22 11:13:00','0','0'); -- id=16529
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6954;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.75','02340', '1254', '166', '2340', '9', '475', '4275', '0', '', '0', '2026-10-22 11:13:00', '2340', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6954-9,','1','1','0','0','475','4275','0','','0','0.00','0','0','0','0'); -- id=5030
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 441.75, meanbuyprice_withDiscount = 441.75
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 441.75
                where sellbilldetailid = 5030;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2340, '2026-10-22', 4275, 4275, 4275
                    , 4275, 3975.75, 3975.75, 3975.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4275, 4275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4275, sellCostBuyPrice =sellCostBuyPrice+4275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3975.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3975.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3975.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4275, 4275, 4275
                    , 4275, 3975.75, 3975.75, 3975.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4275, 4275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4275, sellCostBuyPrice =sellCostBuyPrice+4275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3975.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3975.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3975.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3734';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2340', '1', '9', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '27', '2', '2026-10-22 11:13:00','0','0'); -- id=16530
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('511.5','02031', '1254', '166', '2031', '9', '550', '4950', '0', '', '0', '2026-10-22 11:13:00', '2031', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6955-9,','1','1','0','0','550','4950','0','','0','0.00','0','0','0','0'); -- id=5031
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 511.50, meanbuyprice_withDiscount = 510.62
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 511.5
                where sellbilldetailid = 5031;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2031, '2026-10-22', 4950, 4950, 4950
                    , 4950, 4603.5, 4595.58, 4591.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4950, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4603.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4595.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4591.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4950, 4950, 4950
                    , 4950, 4603.5, 4595.58, 4591.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4950, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4603.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4595.58
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4591.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2031', '1', '9', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '39', '2', '2026-10-22 11:13:00','0','0'); -- id=16531
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6476;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('382.5','02202', '1254', '104', '2202', '8', '450', '3600', '0', '', '0', '2026-10-22 11:13:00', '2202', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6476-8,','1','1','0','0','450','3600','0','','0','0.00','0','0','0','0'); -- id=5032
UPDATE sellbilldetail SET  lastbuyprice = 382.50 , meanbuyprice = 382.50, lastbuyprice_withDiscount = 382.50, meanbuyprice_withDiscount = 382.50
        , lastbuyprice_withTax = 382.5, meanbuyprice_withTax = 382.5, lastbuyprice_withDiscountAndTax = 382.5
                where sellbilldetailid = 5032;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2202, '2026-10-22', 3600, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3600, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '357', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3590';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2202', '1', '8', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '365', '357', '2', '2026-10-22 11:13:00','0','0'); -- id=16532
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02390', '1254', '209', '2390', '12', '350', '4200', '0', '', '0', '2026-10-22 11:13:00', '2390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7050-12,','1','1','0','0','350','4200','0','','0','0.00','0','0','0','0'); -- id=5033
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5033;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2390, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '138', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '12', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '138', '2', '2026-10-22 11:13:00','0','0'); -- id=16533
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 73;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','01381', '1254', '94', '1381', '18', '295', '5310', '0', '', '0', '2026-10-22 11:13:00', '1381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','73-18,','1','1','0','0','295','5310','0','','0','0.00','0','0','0','0'); -- id=5034
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 5034;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-22', 5310, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5310, 4680, 4680
                    , 4680, 4680, 4680, 4680
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4680, 4680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4680, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4680
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4680
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '96', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '18', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '96', '2', '2026-10-22 11:13:00','0','0'); -- id=16534
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '1254', '94', '1378', '3', '360', '1080', '0', '', '0', '2026-10-22 11:13:00', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=5035
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5035;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '397', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '3', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '400', '397', '2', '2026-10-22 11:13:00','0','0'); -- id=16535
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7056;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390.6','02395', '1254', '189', '2395', '3', '420', '1260', '0', '', '0', '2026-10-22 11:13:00', '2395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7056-3,','1','1','0','0','420','1260','0','','0','0.00','0','0','0','0'); -- id=5036
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 390.60, meanbuyprice_withDiscount = 390.60
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 390.6
                where sellbilldetailid = 5036;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2395, '2026-10-22', 1260, 1260, 1260
                    , 1260, 1171.8, 1171.8, 1171.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1171.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1171.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1171.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1260, 1260, 1260
                    , 1260, 1171.8, 1171.8, 1171.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1171.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1171.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1171.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '3', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '33', '2', '2026-10-22 11:13:00','0','0'); -- id=16536
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 71;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('270','01379', '1254', '94', '1379', '3', '300', '900', '0', '', '0', '2026-10-22 11:13:00', '1379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','71-3,','1','1','0','0','300','900','0','','0','0.00','0','0','0','0'); -- id=5037
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where sellbilldetailid = 5037;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1379, '2026-10-22', 900, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 900, 810, 810
                    , 810, 810, 810, 810
                    , 0, 0, 0, 0
                    , 0, 0, 0, 810, 810, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+900, sellCostBuyPrice =sellCostBuyPrice+810
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+810, sellCostMeanBuyPrice = sellCostMeanBuyPrice+810
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+810, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+810
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+810
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+810
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+810
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '212', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '1379';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1379', '1', '3', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '215', '212', '2', '2026-10-22 11:13:00','0','0'); -- id=16537
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02390', '1254', '209', '2390', '9', '350', '3150', '0', '', '0', '2026-10-22 11:13:00', '2390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7050-9,','1','1','0','0','350','3150','0','','0','0.00','0','0','0','0'); -- id=5038
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5038;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2390, '2026-10-22', 3150, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3150, 3150, 3150
                    , 3150, 2898, 2898, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2898
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '129', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '9', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '138', '129', '2', '2026-10-22 11:13:00','0','0'); -- id=16538
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '1254', '94', '1378', '6', '360', '2160', '0', '', '0', '2026-10-22 11:13:00', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5039
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5039;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 2160, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '391', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '6', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '397', '391', '2', '2026-10-22 11:13:00','0','0'); -- id=16539
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 75;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','01383', '1254', '94', '1383', '3', '330', '990', '0', '', '0', '2026-10-22 11:13:00', '1383', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','75-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5040
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5040;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1383, '2026-10-22', 990, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '266', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '1383';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1383', '1', '3', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '269', '266', '2', '2026-10-22 11:13:00','0','0'); -- id=16540
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02390', '1254', '209', '2390', '12', '350', '4200', '0', '', '0', '2026-10-22 11:13:00', '2390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7050-12,','1','1','0','0','350','4200','0','','0','0.00','0','0','0','0'); -- id=5041
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5041;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2390, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '117', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '12', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '129', '117', '2', '2026-10-22 11:13:00','0','0'); -- id=16541
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7056;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390.6','02395', '1254', '189', '2395', '6', '420', '2520', '0', '', '0', '2026-10-22 11:13:00', '2395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7056-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=5042
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 390.60, meanbuyprice_withDiscount = 390.60
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 390.6
                where sellbilldetailid = 5042;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2395, '2026-10-22', 2520, 2520, 2520
                    , 2520, 2343.6, 2343.6, 2343.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2343.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2343.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2343.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2520, 2520, 2520
                    , 2520, 2343.6, 2343.6, 2343.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2520, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2343.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2343.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2343.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 11:13:00' WHERE storedetailid = '3790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '6', '1', '1254', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '27', '2', '2026-10-22 11:13:00','0','0'); -- id=16542
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7893868.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7835323.5','58545', '0', '2', 'اضافة فاتورة مبيعات', '1254', '7893868.5', '2026-10-22 11:13:00', '2',  'sellbillController.php','1','','0'); -- id=1557
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '58545', '58545', '2026-10-22', '2', '0', '0', '2026-10-22 11:13:00','اضافة فاتورة مبيعات رقم 1254','1','0',null,'0','1254','sellbillController.php?do=showDetail&sellbillid=1254'); -- id=4401
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4401', '419', '58545', '','0'); -- id=4520
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7893868', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4401', '143', '58545', '','0'); -- id=4403
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14264215', 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 ( '53716.65', '53716.65', '2026-10-22', '2', '0', '0', '2026-10-22 11:13:00','اضافة فاتورة مبيعات رقم 1254 - صرف البضاعة من المخزن','1','0',null,'0','1254','sellbillController.php?do=showDetail&sellbillid=1254'); -- id=4402
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4402', '402', '53716.65', '','0'); -- id=4521
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13193008.86', 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 ('4402', '382', '53716.65', '','0'); -- id=4404
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26584134.74', 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='4401,0,4402' where sellbillid=1254;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 58545, 55551, 55551
                    , 55551, 53716.65, 53708.73, 53704.23
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55551, 55551, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+58545, sellCostBuyPrice =sellCostBuyPrice+55551
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55551, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55551
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53716.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53708.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53704.23
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55551
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55551
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 58545, 55551, 55551
                    , 55551, 53716.65, 53708.73, 53704.23
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,55551, 55551, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+58545, sellCostBuyPrice =sellCostBuyPrice+55551
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+55551, sellCostMeanBuyPrice = sellCostMeanBuyPrice+55551
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+53716.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+53708.73
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+53704.23
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+55551
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+55551
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 58545, 55551, 55551
                    , 55551, 53716.65, 53708.73, 53704.23, 55551, 55551)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+58545, netSellCostBuyPrice = netSellCostBuyPrice+55551
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+55551
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+55551
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+53716.65
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+53708.73
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+53704.23
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+55551
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+55551;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c18fce465 and sellbillId = 1254 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:43:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:13:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:13:00', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17934
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:47:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:17:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 11:17:25', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17935
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:47:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:17:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 11:17:26', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17936
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:47:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:17:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:17:38', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17937
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:47:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:17:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:17:38', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17938
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:50:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:20:31", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:20:31', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17939

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c57dd7279
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c57dd7279 and sellbillId = 1255 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:50:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:20:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:20:32', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17940
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:52:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:22:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:22:46', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17941
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:52:46";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:22:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:22:46', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17942
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:52:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:22:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:22:48', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17943
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:52:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:22:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:22:55', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17944

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c58c8f658
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:22:55', '06ad9c58c8f658', '1', '0.00', '0', '0', '1', '10600.00', '10600', '10600', '0', '1', '2026-10-22 11:22:55', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '32' ,'0','','','','','-1','0','0','0','0','0','10600','0','','0','0','10600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1256
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1256', '0', '2026-10-22 11:22:55', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:22:55','0','0','',''); -- id=1485
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6759;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('294.4','02274', '1256', '71', '2274', '4', '320', '1280', '0', '', '0', '2026-10-22 11:22:55', '2274', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6759-4,','1','1','0','0','320','1280','0','','0','0.00','0','0','0','0'); -- id=5045
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 294.40, meanbuyprice_withDiscount = 294.40
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 294.4
                where sellbilldetailid = 5045;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2274, '2026-10-22', 1280, 1280, 1280
                    , 1280, 1177.6, 1177.6, 1177.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1280, 1280, 1280
                    , 1280, 1177.6, 1177.6, 1177.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '64', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2274', '1', '4', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '64', '2', '2026-10-22 11:22:55','0','0'); -- id=16545
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6645;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02242', '1256', '72', '2242', '3', '340', '1020', '0', '', '0', '2026-10-22 11:22:55', '2242', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6645-3,','1','1','0','0','340','1020','0','','0','0.00','0','0','0','0'); -- id=5046
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5046;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2242, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3633';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2242', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '2', '2026-10-22 11:22:55','0','0'); -- id=16546
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02082', '1256', '43', '2082', '3', '340', '1020', '0', '', '0', '2026-10-22 11:22:55', '2082', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6127-3,','1','1','0','0','340','1020','0','','0','0.00','0','0','0','0'); -- id=5047
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5047;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2082, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3441';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2082', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '39', '2', '2026-10-22 11:22:55','0','0'); -- id=16547
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6759;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('294.4','02274', '1256', '71', '2274', '3', '320', '960', '0', '', '0', '2026-10-22 11:22:55', '2274', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6759-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5048
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 294.40, meanbuyprice_withDiscount = 294.40
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 294.4
                where sellbilldetailid = 5048;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2274, '2026-10-22', 960, 960, 960
                    , 960, 883.2, 883.2, 883.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+883.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+883.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+883.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 960, 960
                    , 960, 883.2, 883.2, 883.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+883.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+883.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+883.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '61', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2274', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64', '61', '2', '2026-10-22 11:22:55','0','0'); -- id=16548
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1170;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01976', '1256', '59', '1976', '3', '320', '960', '0', '', '0', '2026-10-22 11:22:55', '1976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1170-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5049
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5049;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 960, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '48', '2', '2026-10-22 11:22:55','0','0'); -- id=16549
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02082', '1256', '43', '2082', '3', '340', '1020', '0', '', '0', '2026-10-22 11:22:55', '2082', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6127-3,','1','1','0','0','340','1020','0','','0','0.00','0','0','0','0'); -- id=5050
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5050;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2082, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3441';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2082', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '36', '2', '2026-10-22 11:22:55','0','0'); -- id=16550
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02082', '1256', '43', '2082', '6', '340', '2040', '0', '', '0', '2026-10-22 11:22:55', '2082', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6127-6,','1','1','0','0','340','2040','0','','0','0.00','0','0','0','0'); -- id=5051
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5051;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2082, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3441';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2082', '1', '6', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '30', '2', '2026-10-22 11:22:55','0','0'); -- id=16551
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6645;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02242', '1256', '72', '2242', '3', '340', '1020', '0', '', '0', '2026-10-22 11:22:55', '2242', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6645-3,','1','1','0','0','340','1020','0','','0','0.00','0','0','0','0'); -- id=5052
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5052;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2242, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3633';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2242', '1', '3', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '2', '2026-10-22 11:22:55','0','0'); -- id=16552
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6759;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('294.4','02274', '1256', '71', '2274', '4', '320', '1280', '0', '', '0', '2026-10-22 11:22:55', '2274', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6759-4,','1','1','0','0','320','1280','0','','0','0.00','0','0','0','0'); -- id=5053
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 294.40, meanbuyprice_withDiscount = 294.40
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 294.4
                where sellbilldetailid = 5053;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2274, '2026-10-22', 1280, 1280, 1280
                    , 1280, 1177.6, 1177.6, 1177.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1280, 1280, 1280
                    , 1280, 1177.6, 1177.6, 1177.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1280, 1280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1280, sellCostBuyPrice =sellCostBuyPrice+1280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1177.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1177.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1177.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-22 11:22:55' WHERE storedetailid = '3667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2274', '1', '4', '1', '1256', 'اضافة فاتورة مبيعات', 'sellbillController.php', '61', '57', '2', '2026-10-22 11:22:55','0','0'); -- id=16553
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7904468.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7893868.5','10600', '0', '2', 'اضافة فاتورة مبيعات', '1256', '7904468.5', '2026-10-22 11:22:55', '2',  'sellbillController.php','1','','0'); -- id=1559
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10600', '10600', '2026-10-22', '2', '0', '0', '2026-10-22 11:22:55','اضافة فاتورة مبيعات رقم 1256','1','0',null,'0','1256','sellbillController.php?do=showDetail&sellbillid=1256'); -- id=4405
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4405', '419', '10600', '','0'); -- id=4524
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7904468', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4405', '143', '10600', '','0'); -- id=4407
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14278595', 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 ( '9676.4', '9676.4', '2026-10-22', '2', '0', '0', '2026-10-22 11:22:55','اضافة فاتورة مبيعات رقم 1256 - صرف البضاعة من المخزن','1','0',null,'0','1256','sellbillController.php?do=showDetail&sellbillid=1256'); -- id=4406
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4406', '402', '9676.4', '','0'); -- id=4525
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13206300.26', 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 ('4406', '382', '9676.4', '','0'); -- id=4408
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26570843.34', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='4405,0,4406' where sellbillid=1256;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10600, 10570, 10570
                    , 10570, 9676.4, 9676.4, 9676.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10570, 10570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10600, sellCostBuyPrice =sellCostBuyPrice+10570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9676.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9676.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9676.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10600, 10570, 10570
                    , 10570, 9676.4, 9676.4, 9676.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10570, 10570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10600, sellCostBuyPrice =sellCostBuyPrice+10570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9676.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9676.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9676.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10600, 10570, 10570
                    , 10570, 9676.4, 9676.4, 9676.4, 10570, 10570)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10600, netSellCostBuyPrice = netSellCostBuyPrice+10570
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10570
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10570
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9676.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9676.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9676.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10570
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10570;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c58c8f658 and sellbillId = 1256 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:52:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:22:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:22:55', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17945
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:53:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:23:16", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:23:16', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17946

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c75038c95
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c75038c95 and sellbillId = 1257 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:53:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:23:19", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:23:19', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17947
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:07', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17948
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:08', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17949
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:26', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17950

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bc8e0ee22
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bc8e0ee22 and sellbillId = 1258 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:26", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:26', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17951
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:38', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17952
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:38', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17953
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17954
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17955
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:50", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 11:24:50', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=17956
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:54:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:24:54", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:24:54', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1243'); -- id=17957
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:55:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:25:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:25:14', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17958
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:55:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:25:17", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:25:17', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17959

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9b558d3ded
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:25:17', '06ad9b558d3ded', '1', '0.00', '0', '0', '1', '12965.00', '12965', '12965', '0', '1', '2026-10-22 11:25:17', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '26' ,'0','','','','','-1','0','0','0','0','0','12965','0','','0','0','12965','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1259
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1259', '0', '2026-10-22 11:25:17', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '12965', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:25:17','0','0','',''); -- id=1488
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7021;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('455.4','02376', '1259', '111', '2376', '12', '495', '5940', '0', '', '0', '2026-10-22 11:25:17', '2376', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7021-12,','1','1','0','0','495','5940','0','','0','0.00','0','0','0','0'); -- id=5056
UPDATE sellbilldetail SET  lastbuyprice = 495.00 , meanbuyprice = 495.00, lastbuyprice_withDiscount = 455.40, meanbuyprice_withDiscount = 455.40
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 495, lastbuyprice_withDiscountAndTax = 455.4
                where sellbilldetailid = 5056;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2376, '2026-10-22', 5940, 5940, 5940
                    , 5940, 5464.8, 5464.8, 5464.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5940, 5940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5940, sellCostBuyPrice =sellCostBuyPrice+5940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5464.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5464.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5464.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5940, 5940, 5940
                    , 5940, 5464.8, 5464.8, 5464.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5940, 5940, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5940, sellCostBuyPrice =sellCostBuyPrice+5940
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5940, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5940
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5464.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5464.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5464.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5940
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5940
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '6', storedetaildate = '2026-10-22 11:25:17' WHERE storedetailid = '3770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2376', '1', '12', '1', '1259', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '9', '6', '2026-10-22 11:25:17','0','0'); -- id=16556
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6799;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','02291', '1259', '203', '2291', '9', '450', '4050', '0', '', '0', '2026-10-22 11:25:17', '2291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6799-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5057
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 5057;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2291, '2026-10-22', 4050, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4050, 3780, 3780
                    , 3780, 3780, 3780, 3780
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3780, 3780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '84', userid = '6', storedetaildate = '2026-10-22 11:25:17' WHERE storedetailid = '3684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2291', '1', '9', '1', '1259', 'اضافة فاتورة مبيعات', 'sellbillController.php', '93', '84', '6', '2026-10-22 11:25:17','0','0'); -- id=16557
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1259', '175', '2088', '5', '595', '2975', '0', '', '0', '2026-10-22 11:25:17', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-5,','1','1','0','0','595','2975','0','','0','0.00','0','0','0','0'); -- id=5058
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5058;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '986', userid = '6', storedetaildate = '2026-10-22 11:25:17' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '5', '1', '1259', 'اضافة فاتورة مبيعات', 'sellbillController.php', '991', '986', '6', '2026-10-22 11:25:17','0','0'); -- id=16558
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1188670',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1175705','12965', '0', '4', 'اضافة فاتورة مبيعات', '1259', '1188670', '2026-10-22 11:25:17', '6',  'sellbillController.php','1','','0'); -- id=1562
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '12965', '12965', '2026-10-22', '6', '0', '0', '2026-10-22 11:25:17','اضافة فاتورة مبيعات رقم 1259','1','0',null,'0','1259','sellbillController.php?do=showDetail&sellbillid=1259'); -- id=4411
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4411', '568', '12965', '','0'); -- id=4530
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1188670', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4411', '143', '12965', '','0'); -- id=4413
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14299210', 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 ( '11544.8', '11544.8', '2026-10-22', '6', '0', '0', '2026-10-22 11:25:17','اضافة فاتورة مبيعات رقم 1259 - صرف البضاعة من المخزن','1','0',null,'0','1259','sellbillController.php?do=showDetail&sellbillid=1259'); -- id=4412
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4412', '402', '11544.8', '','0'); -- id=4531
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13225045.06', 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 ('4412', '382', '11544.8', '','0'); -- id=4414
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26556898.54', 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='4411,0,4412' where sellbillid=1259;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 12965, 12020, 12020
                    , 12020, 11544.8, 11544.8, 11544.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12020, 12020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12965, sellCostBuyPrice =sellCostBuyPrice+12020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11544.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11544.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11544.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12965, 12020, 12020
                    , 12020, 11544.8, 11544.8, 11544.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12020, 12020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12965, sellCostBuyPrice =sellCostBuyPrice+12020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11544.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11544.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11544.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 12965, 12020, 12020
                    , 12020, 11544.8, 11544.8, 11544.8, 12020, 12020)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+12965, netSellCostBuyPrice = netSellCostBuyPrice+12020
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12020
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12020
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+11544.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+11544.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+11544.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12020
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12020;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9b558d3ded and sellbillId = 1259 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:55:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:25:17", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:25:17', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17960
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:55:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:25:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:25:58', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17961

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c84867557
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 11:25:58', '06ad9c84867557', '1', '0.00', '0', '0', '1', '580', '580', '-580', '0', '1', '2026-10-22 11:25:58', '', '3', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-580','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=43
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','43', '0', '2026-10-22 11:25:58', '3', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '580', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:25:58','0','0','',''); -- id=1489
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('270.00', '08302', '43', '72', '1251', '2', '290', '580', '0', '', '0', '0', '1251', '0.00', '0','1','0','','','0','0','0','0','0','0','1','1','','0','0','290','580','0','','0'); -- id=61
UPDATE returnsellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where returnsellbilldetailid = 61;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1251, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 580, 540, 540, 540
                    , 540, 540, 540, 0, 2, 0, 0, 540, 540)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+580, returnSellCostBuyPrice = returnSellCostBuyPrice+540, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+540
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+540
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+540
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+540
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+540
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 580, 540, 540, 540
                    , 540, 540, 540, 0, 0, 540, 540)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+580, returnSellCostBuyPrice = returnSellCostBuyPrice+540, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+540
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+540
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+540
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+540
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+540;
UPDATE storedetail SET  productquantity = '26', userid = '3', storedetaildate = '2026-10-22 11:25:58' WHERE storedetailid = '1251';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1251', '1', '2', '0', '43', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '24', '26', '3', '2026-10-22 11:25:58','0','0'); -- id=16559
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7903888.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7904468.5','-580', '1', '2', 'اضافة فاتورة مردوات مبيعات', '43', '7903888.5', '2026-10-22 11:25:58', '3',  'returnsellbillController.php','1','','0'); -- id=1563
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '580', '580', '2026-10-22', '3', '0', '0', '2026-10-22 11:25:58','اضافة فاتورة مردود مبيعات رقم 43','1','0',null,'0','43','returnsellbillController.php?do=showDetail&returnsellbillid=43'); -- id=4413
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4413', '143', '580', '','0'); -- id=4532
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14298630', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4413', '419', '580', '','0'); -- id=4415
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7903888', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '540', '540', '2026-10-22', '3', '0', '0', '2026-10-22 11:25:58','اضافة فاتورة مردود مبيعات رقم 43 - صرف البضاعة من المخزن','1','0',null,'0','43','returnsellbillController.php?do=showDetail&returnsellbillid=43'); -- id=4414
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4414', '382', '540', '','0'); -- id=4533
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26557438.54', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4414', '402', '540', '','0'); -- id=4416
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13224505.06', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4413,0,4414' where returnsellbillid=43;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 580, 540, 540, 540
                    , 540, 540, 540 ,0, 0, 540, 540)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+580, returnSellCostBuyPrice = returnSellCostBuyPrice+540, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+540
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+540
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+540
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+540
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+540;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 580, 540, 540, 540
                    , 540, 540, 540 ,0, 0, 540, 540)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+580, returnSellCostBuyPrice = returnSellCostBuyPrice+540, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+540
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+540, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+540
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+540
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+540
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+540
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+540;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -580, -540, -540
                    , -540, -540, -540, -540, -540, -540)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-580, netSellCostBuyPrice = netSellCostBuyPrice+-540
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-540
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-540
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-540
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-540
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-540
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-540
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-540;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c84867557 and sellbillId = 43 and returnsellbillId = 43
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:55:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:25:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:25:58', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=17962
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:56:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:26:35", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:26:35', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17963
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:56:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:26:35", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:26:35', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17964
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:57:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:27:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:27:25', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17965

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c6a27bf3d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:27:25', '06ad9c6a27bf3d', '1', '0.00', '0', '0', '1', '8745.00', '8745', '8745', '0', '1', '2026-10-22 11:27:25', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '19' ,'0','','','','','-1','0','0','0','0','0','8745','0','','0','0','8745','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1260
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1260', '0', '2026-10-22 11:27:25', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8745', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:27:25','0','0','',''); -- id=1490
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 5974;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('515','i0002004', '1260', '162', '2004', '3', '550', '1650', '0', '', '0', '2026-10-22 11:27:25', '2004', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5974-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=5059
UPDATE sellbilldetail SET  lastbuyprice = 515.00 , meanbuyprice = 515.00, lastbuyprice_withDiscount = 515.00, meanbuyprice_withDiscount = 515.00
        , lastbuyprice_withTax = 515, meanbuyprice_withTax = 257.5, lastbuyprice_withDiscountAndTax = 515
                where sellbilldetailid = 5059;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2004, '2026-10-22', 1650, 1545, 1545
                    , 1545, 1545, 1545, 1545
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1545, 772.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1545
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1545, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1545
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1545
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+772.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1650, 1545, 1545
                    , 1545, 1545, 1545, 1545
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1545, 772.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1545
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1545, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1545
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1545
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+772.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '3', storedetaildate = '2026-10-22 11:27:25' WHERE storedetailid = '3362';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2004', '1', '3', '1', '1260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '6', '3', '2026-10-22 11:27:25','0','0'); -- id=16560
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6174;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450.8','02106', '1260', '179', '2106', '3', '490', '1470', '0', '', '0', '2026-10-22 11:27:25', '2106', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6174-3,','1','1','0','0','490','1470','0','','0','0.00','0','0','0','0'); -- id=5060
UPDATE sellbilldetail SET  lastbuyprice = 490.00 , meanbuyprice = 490.00, lastbuyprice_withDiscount = 450.80, meanbuyprice_withDiscount = 450.80
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 450.8
                where sellbilldetailid = 5060;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2106, '2026-10-22', 1470, 1470, 1470
                    , 1470, 1352.4, 1352.4, 1352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1470
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1470, 1470, 1470
                    , 1470, 1352.4, 1352.4, 1352.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1470, 1470, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1470, sellCostBuyPrice =sellCostBuyPrice+1470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1352.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1352.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1352.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1470
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '93', userid = '3', storedetaildate = '2026-10-22 11:27:25' WHERE storedetailid = '3465';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2106', '1', '3', '1', '1260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '96', '93', '3', '2026-10-22 11:27:25','0','0'); -- id=16561
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 5979;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('365','02006', '1260', '162', '2006', '3', '400', '1200', '0', '', '0', '2026-10-22 11:27:25', '2006', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5979-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5061
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 182.5, lastbuyprice_withDiscountAndTax = 365
                where sellbilldetailid = 5061;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2006, '2026-10-22', 1200, 1095, 1095
                    , 1095, 1095, 1095, 1095
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1095, 547.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1095
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1095, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1095
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1095, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1095
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1095
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1095
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+547.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1095, 1095
                    , 1095, 1095, 1095, 1095
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1095, 547.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1095
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1095, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1095
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1095, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1095
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1095
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1095
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+547.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 11:27:25' WHERE storedetailid = '3364';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2006', '1', '3', '1', '1260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '3', '2026-10-22 11:27:25','0','0'); -- id=16562
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','09813', '1260', '24', '889', '5', '430', '2150', '0', '', '0', '2026-10-22 11:27:25', '889', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','430','2150','0','','0','0.00','0','0','0','0'); -- id=5062
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5062;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (889, '2026-10-22', 2150, 2050, 2050
                    , 2050, 2050, 2050, 2050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2050, 2050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2150, sellCostBuyPrice =sellCostBuyPrice+2050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2150, 2050, 2050
                    , 2050, 2050, 2050, 2050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2050, 2050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2150, sellCostBuyPrice =sellCostBuyPrice+2050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '3', storedetaildate = '2026-10-22 11:27:25' WHERE storedetailid = '889';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('889', '1', '5', '1', '1260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '20', '3', '2026-10-22 11:27:25','0','0'); -- id=16563
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','09714', '1260', '11', '770', '5', '455', '2275', '0', '', '0', '2026-10-22 11:27:25', '770', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','455','2275','0','','0','0.00','0','0','0','0'); -- id=5063
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5063;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (770, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '269', userid = '3', storedetaildate = '2026-10-22 11:27:25' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('770', '1', '5', '1', '1260', 'اضافة فاتورة مبيعات', 'sellbillController.php', '274', '269', '3', '2026-10-22 11:27:25','0','0'); -- id=16564
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7912633.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7903888.5','8745', '0', '2', 'اضافة فاتورة مبيعات', '1260', '7912633.5', '2026-10-22 11:27:25', '3',  'sellbillController.php','1','','0'); -- id=1564
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8745', '8745', '2026-10-22', '3', '0', '0', '2026-10-22 11:27:25','اضافة فاتورة مبيعات رقم 1260','1','0',null,'0','1260','sellbillController.php?do=showDetail&sellbillid=1260'); -- id=4415
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4415', '419', '8745', '','0'); -- id=4534
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7912633', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4415', '143', '8745', '','0'); -- id=4417
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14307375', 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 ( '8217.4', '8217.4', '2026-10-22', '3', '0', '0', '2026-10-22 11:27:25','اضافة فاتورة مبيعات رقم 1260 - صرف البضاعة من المخزن','1','0',null,'0','1260','sellbillController.php?do=showDetail&sellbillid=1260'); -- id=4416
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4416', '402', '8217.4', '','0'); -- id=4535
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13232722.46', 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 ('4416', '382', '8217.4', '','0'); -- id=4418
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26549221.14', 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='4415,0,4416' where sellbillid=1260;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 8745, 8335, 8335
                    , 8335, 8217.4, 8217.4, 8217.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8335, 7015, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8745, sellCostBuyPrice =sellCostBuyPrice+8335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8217.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8217.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8217.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7015
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8745, 8335, 8335
                    , 8335, 8217.4, 8217.4, 8217.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8335, 7015, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8745, sellCostBuyPrice =sellCostBuyPrice+8335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8217.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8217.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8217.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7015
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 8745, 8335, 8335
                    , 8335, 8217.4, 8217.4, 8217.4, 8335, 7015)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8745, netSellCostBuyPrice = netSellCostBuyPrice+8335
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8335
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8335
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8217.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8217.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8217.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8335
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+7015;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c6a27bf3d and sellbillId = 1260 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:57:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:27:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:27:25', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17966
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:58:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:28:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:28:25', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17967
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:58:25";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:28:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:28:25', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17968
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:58:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:28:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:28:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17969
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:58:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:28:33", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:28:33', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17970

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c7dfacbbf
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:28:33', '06ad9c7dfacbbf', '1', '0.00', '0', '0', '1', '18495.00', '18495', '18495', '0', '1', '2026-10-22 11:28:33', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '45' ,'0','','','','','-1','0','0','0','0','0','18495','0','','0','0','18495','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1261
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1261', '0', '2026-10-22 11:28:33', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '18495', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:28:33','0','0','',''); -- id=1491
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 1137;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470.25','01960', '1261', '159', '1960', '4', '495', '1980', '0', '', '0', '2026-10-22 11:28:33', '1960', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1137-4,','1','1','0','0','495','1980','0','','0','0.00','0','0','0','0'); -- id=5064
UPDATE sellbilldetail SET  lastbuyprice = 495.00 , meanbuyprice = 490.38, lastbuyprice_withDiscount = 470.25, meanbuyprice_withDiscount = 471.35
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 490.38, lastbuyprice_withDiscountAndTax = 470.25
                where sellbilldetailid = 5064;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1960, '2026-10-22', 1980, 1980, 1980
                    , 1961.52, 1881, 1885.4, 1881
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1980, 1961.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1961.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1881, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1885.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1881
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1961.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1980, 1980, 1980
                    , 1961.52, 1881, 1885.4, 1881
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1980, 1961.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1961.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1881, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1885.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1881
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1961.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '2977';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1960', '1', '4', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '20', '2', '2026-10-22 11:28:33','0','0'); -- id=16565
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1261', '153', '1921', '3', '485', '1455', '0', '', '0', '2026-10-22 11:28:33', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-3,','1','1','0','0','485','1455','0','','0','0.00','0','0','0','0'); -- id=5065
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5065;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 1455, 1380, 1380
                    , 1380, 1380, 1380, 1380
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1455, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1455, 1380, 1380
                    , 1380, 1380, 1380, 1380
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1455, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '119', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '3', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '122', '119', '2', '2026-10-22 11:28:33','0','0'); -- id=16566
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6132;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','02085', '1261', '174', '2085', '3', '460', '1380', '0', '', '0', '2026-10-22 11:28:33', '2085', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6132-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=5066
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 5066;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2085, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '156', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '3444';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2085', '1', '3', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '159', '156', '2', '2026-10-22 11:28:33','0','0'); -- id=16567
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6293;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02177', '1261', '190', '2177', '4', '335', '1340', '0', '', '0', '2026-10-22 11:28:33', '2177', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6293-4,','1','1','0','0','335','1340','0','','0','0.00','0','0','0','0'); -- id=5067
UPDATE sellbilldetail SET  lastbuyprice = 315.00 , meanbuyprice = 315.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 157.5, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5067;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2177, '2026-10-22', 1340, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1260, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1340, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1340, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1340, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '3537';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2177', '1', '4', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '20', '2', '2026-10-22 11:28:33','0','0'); -- id=16568
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6132;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','02085', '1261', '174', '2085', '3', '460', '1380', '0', '', '0', '2026-10-22 11:28:33', '2085', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6132-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=5068
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 414.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 5068;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2085, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1242, 1242, 1242
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1242, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1242
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1242
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '153', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '3444';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2085', '1', '3', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '156', '153', '2', '2026-10-22 11:28:33','0','0'); -- id=16569
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 979;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1261', '147', '1885', '6', '390', '2340', '0', '', '0', '2026-10-22 11:28:33', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','979-1,6991-5,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5069
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5069;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '139', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '6', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '145', '139', '2', '2026-10-22 11:28:33','0','0'); -- id=16570
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6913;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('368','01584', '1261', '115', '1584', '3', '400', '1200', '0', '', '0', '2026-10-22 11:28:33', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6913-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5070
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 368.00, meanbuyprice_withDiscount = 368.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 368
                where sellbilldetailid = 5070;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1104, 1104, 1114.17
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1114.17
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1104, 1104, 1114.17
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1104, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1104
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1114.17
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '3', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '2', '2026-10-22 11:28:33','0','0'); -- id=16571
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6297;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('365','02181', '1261', '190', '2181', '4', '385', '1540', '0', '', '0', '2026-10-22 11:28:33', '2181', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6297-4,','1','1','0','0','385','1540','0','','0','0.00','0','0','0','0'); -- id=5071
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 365, lastbuyprice_withDiscountAndTax = 365
                where sellbilldetailid = 5071;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2181, '2026-10-22', 1540, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1540, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1540, 1460, 1460
                    , 1460, 1460, 1460, 1460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1460, 1460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1540, sellCostBuyPrice =sellCostBuyPrice+1460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '3541';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2181', '1', '4', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '56', '2', '2026-10-22 11:28:33','0','0'); -- id=16572
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6765;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1261', '147', '1886', '6', '320', '1920', '0', '', '0', '2026-10-22 11:28:33', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=5072
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5072;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 1920, 1734, 1734
                    , 1734, 1734, 1734, 1734
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1734, 1734, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1734
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1734, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1734
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1734, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1734
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1734
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1734
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1734
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1920, 1734, 1734
                    , 1734, 1734, 1734, 1734
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1734, 1734, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1734
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1734, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1734
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1734, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1734
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1734
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1734
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1734
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '106', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '6', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '106', '2', '2026-10-22 11:28:33','0','0'); -- id=16573
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6902;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('396','02332', '1261', '165', '2332', '9', '440', '3960', '0', '', '0', '2026-10-22 11:28:33', '2332', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6902-9,','1','1','0','0','440','3960','0','','0','0.00','0','0','0','0'); -- id=5073
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 396.00, meanbuyprice_withDiscount = 396.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 396
                where sellbilldetailid = 5073;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2332, '2026-10-22', 3960, 3960, 3960
                    , 3960, 3564, 3564, 3564
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3564, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3564
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3564
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3960, 3960, 3960
                    , 3960, 3564, 3564, 3564
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3960, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3564, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3564
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3564
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '2', storedetaildate = '2026-10-22 11:28:33' WHERE storedetailid = '3726';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2332', '1', '9', '1', '1261', 'اضافة فاتورة مبيعات', 'sellbillController.php', '99', '90', '2', '2026-10-22 11:28:33','0','0'); -- id=16574
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7931128.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7912633.5','18495', '0', '2', 'اضافة فاتورة مبيعات', '1261', '7931128.5', '2026-10-22 11:28:33', '2',  'sellbillController.php','1','','0'); -- id=1565
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18495', '18495', '2026-10-22', '2', '0', '0', '2026-10-22 11:28:33','اضافة فاتورة مبيعات رقم 1261','1','0',null,'0','1261','sellbillController.php?do=showDetail&sellbillid=1261'); -- id=4417
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4417', '419', '18495', '','0'); -- id=4536
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7931128', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4417', '143', '18495', '','0'); -- id=4419
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14325870', 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 ( '17021', '17021', '2026-10-22', '2', '0', '0', '2026-10-22 11:28:33','اضافة فاتورة مبيعات رقم 1261 - صرف البضاعة من المخزن','1','0',null,'0','1261','sellbillController.php?do=showDetail&sellbillid=1261'); -- id=4418
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4418', '402', '17021', '','0'); -- id=4537
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13249743.46', 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 ('4418', '382', '17021', '','0'); -- id=4420
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26532200.14', 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='4417,0,4418' where sellbillid=1261;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 18495, 17888, 17888
                    , 17869.52, 17021, 17025.4, 17031.17
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17888, 17239.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18495, sellCostBuyPrice =sellCostBuyPrice+17888
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17888, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17869.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17021, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17025.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17031.17
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17888
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17239.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 18495, 17888, 17888
                    , 17869.52, 17021, 17025.4, 17031.17
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17888, 17239.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+18495, sellCostBuyPrice =sellCostBuyPrice+17888
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17888, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17869.52
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+17021, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+17025.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+17031.17
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17888
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17239.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 18495, 17888, 17888
                    , 17869.52, 17021, 17025.4, 17031.17, 17888, 17239.52)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+18495, netSellCostBuyPrice = netSellCostBuyPrice+17888
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+17888
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+17869.52
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+17021
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+17025.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+17031.17
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+17888
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+17239.52;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c7dfacbbf and sellbillId = 1261 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:58:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:28:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:28:34', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17971
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:59:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:29:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:29:32', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17972
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 07:59:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:29:32", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:29:32', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17973
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:00:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:30:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:30:32', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17974

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c86db14f5
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c86db14f5 and sellbillId = 1262 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:00:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:30:33", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:30:33', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17975
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:01:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:31:38", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:31:38', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17976

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c9a90d6a9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c9a90d6a9 and sellbillId = 1263 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:01:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:31:38", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:31:38', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17977
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:32:05', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17978

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c96c5badd
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c96c5badd and sellbillId = 1264 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:32:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17979
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:32:17', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17980
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:17";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:32:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:32:17', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17981
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:32:19', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17982
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:41";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:32:47', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17983
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:48";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:32:48', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17984
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:02:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:32:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:32:58', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17985
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:33:02', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17986
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:33:02', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17987
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:33:12', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=17988
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:33:24', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=17989
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:33:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17990
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 11:33:50', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=17991
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:33:53', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17992
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:53";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:33:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:33:53', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=17993
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:33:55', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17994
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:03:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:33:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:33:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=17995
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 11:34:18', '7', 'autosave', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=17996
UPDATE storedetail SET  productquantity = '09', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2937';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1920', '1', '3', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '6', '09', '7', '2026-10-22','0','0'); -- id=16578
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1110', '1110', '2026-10-22', '7', '0', '0', '2026-10-22 11:34:18','اعادة جرد للمنتج : (سويت شيرت 395 مصطفي زورو/مصطفي زورو) فى مخزن : (المخزن الرئيسي) بالكمية : 09','1','0',null,'0','16578','inventoryController.php?do=details&id=16578'); -- id=4425
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4425', '382', '1110', '','0'); -- id=4544
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26519288.14', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4425', '188', '1110', '','0'); -- id=4427
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3248520', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:34:20', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=17997

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c932273c2
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c932273c2 and sellbillId = 1265 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:34:20', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=17998
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:34:35', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=17999
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:35";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:34:36', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18000
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:34:37', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18001
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:34:53', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18002
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('فيرست لاين','2026-10-22','','93', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=211
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (211, 1,'2026-10-22 11:34:53',7)
                ON DUPLICATE KEY UPDATE catid = 211, edited = 1, sysdate = '2026-10-22 11:34:53', userid = 7; -- id=226
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '211', '1', '2026-10-22', '7', '0'); -- id=101
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:34:53', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18003
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:34:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18004
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:34:56', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18005
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:34:57', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18006
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:34:59', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18007
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:04:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:34:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:34:59', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18008
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:05:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:35:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:35:18', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18009
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 101 بوينت وان ','','188','600','600','0','0','2026-10-22','0','5','0','','0','0','0','0','0','600','600','600','600','600','0','0','0','0','.','0','0','0','600','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','600','600','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','600','0','0','0','0','0','0','','','0','0','0','0'); -- id=2415
UPDATE product SET productName = 'موديل 101 بوينت وان ', productDescription = '', productCatId = '188', productBuyPrice = '600', productSellAllPrice = '600', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02415',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',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='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2415';
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', '2415', '1', '2026-10-22', '5', '0','0241501','600','0','0','600','','0','0','0','0','0','0','0','0','0','0'); -- id=2415
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2415', '1', '0', '5', '2026-10-22'); -- id=3810
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2415', '1', '0', '0', '2415', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16580
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2415, 1,'2026-10-22 11:35:18',5)
                ON DUPLICATE KEY UPDATE productid = 2415, edited = 1, sysdate = '2026-10-22 11:35:18', userid = 5; -- id=3597
UPDATE product SET productName = 'موديل 101 بوينت وان ', productDescription = '', productCatId = '188', productBuyPrice = '600.00', productSellAllPrice = '600.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02415',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',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='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2415';
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 ('موديل 102 بويبت وان','','188','490','490','0','0','2026-10-22','0','5','0','','0','0','0','0','0','490','490','490','490','490','0','0','0','0','.','0','0','0','490','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','490','490','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','490','0','0','0','0','0','0','','','0','0','0','0'); -- id=2416
UPDATE product SET productName = 'موديل 102 بويبت وان', productDescription = '', productCatId = '188', productBuyPrice = '490', productSellAllPrice = '490', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02416',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '490',meanbuyprice = '490',meanbuyprice_withDiscount = '490' , productbuypricereal = '490' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='490',meanbuyprice_withTax='490',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='490',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2416';
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', '2416', '1', '2026-10-22', '5', '0','0241601','490','0','0','490','','0','0','0','0','0','0','0','0','0','0'); -- id=2416
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2416', '1', '0', '5', '2026-10-22'); -- id=3811
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2416', '1', '0', '0', '2416', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16581
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2416, 1,'2026-10-22 11:35:18',5)
                ON DUPLICATE KEY UPDATE productid = 2416, edited = 1, sysdate = '2026-10-22 11:35:18', userid = 5; -- id=3598
UPDATE product SET productName = 'موديل 102 بويبت وان', productDescription = '', productCatId = '188', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02416',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '490',meanbuyprice = '490',meanbuyprice_withDiscount = '490' , productbuypricereal = '490' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='490',meanbuyprice_withTax='490',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='490',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2416';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:05:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:35:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:35:19', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18010
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:05:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:35:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:35:19', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18011
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:36:08', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18012

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c86af3b89
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c86af3b89 and sellbillId = 1266 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:36:08', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18013
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:21", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:36:21', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18014

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ca8c86f7f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ca8c86f7f and sellbillId = 1267 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:21", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:36:21', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18015
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:36:30', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18016
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 ('06ad9cac7c46c1', '2026-10-22 11:35:19', '144', '96832.00', '126916', '8', '1', '32700.00',  '30084.00', '0', '30084', '1', '2026-10-22 11:36:30', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=328
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 ('02415', '328', '188', '2415', '30', '600', '18000.00', '0', '', '2026-10-22 11:36:30', '2415','','','0','0','0','0','0',null,'600','18000','0','0','0','0','0','0','0','0','1'); -- id=1761
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:35:19', 1, 2415, 0, 0
                    , 552, 30, 0, 0, 5, '2026-10-22 11:36:30')
                ON DUPLICATE KEY UPDATE buyprice = 552,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:36:30' ; -- id=7087
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2415', '600', '30', '0', 'buyBillController.php', '1761', '', '0', '0'); -- id=1307
UPDATE product SET  productBuyPrice = "600" WHERE productId = 2415 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1761 ;
UPDATE product SET productName = 'موديل 101 بوينت وان ', productDescription = '', productCatId = '188', productBuyPrice = '600.00', productSellAllPrice = '600.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02415',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '552',meanbuyprice = '600',meanbuyprice_withDiscount = '552' , productbuypricereal = '600.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='600',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='600',meanbuyprice_withTax='600',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='552',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2415';
UPDATE buybilldetail SET  lastbuyprice = 600 , meanbuyprice = 600, lastbuyprice_withDiscount = 552, meanbuyprice_withDiscount = 552
        , lastbuyprice_withTax = 600, meanbuyprice_withTax = 600, lastbuyprice_withDiscountAndTax = 552
                where buybilldetailid = 1761;
UPDATE productunit SET proUnitBuyPrice  = 600 * productnumber WHERE productid = 2415;
UPDATE storedetail SET  productquantity = '30', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3810';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2415', '1', '30', '0', '328', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '5', '2026-10-22 11:35:19','0','0'); -- id=16585
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 ('02416', '328', '188', '2416', '30', '490', '14700.00', '0', '', '2026-10-22 11:36:30', '2416','','','0','0','0','0','0',null,'490','14700','0','0','0','0','0','0','0','0','1'); -- id=1762
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:35:19', 1, 2416, 0, 0
                    , 450.8, 30, 0, 0, 5, '2026-10-22 11:36:30')
                ON DUPLICATE KEY UPDATE buyprice = 450.8,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:36:30' ; -- id=7088
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2416', '490', '30', '0', 'buyBillController.php', '1762', '', '0', '0'); -- id=1308
UPDATE product SET  productBuyPrice = "490" WHERE productId = 2416 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1762 ;
UPDATE product SET productName = 'موديل 102 بويبت وان', productDescription = '', productCatId = '188', productBuyPrice = '490.00', productSellAllPrice = '490.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02416',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490',lastbuyprice_withDiscount = '450.8',meanbuyprice = '490',meanbuyprice_withDiscount = '450.8' , productbuypricereal = '490.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='490',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='490',meanbuyprice_withTax='490',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450.8',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2416';
UPDATE buybilldetail SET  lastbuyprice = 490 , meanbuyprice = 490, lastbuyprice_withDiscount = 450.8, meanbuyprice_withDiscount = 450.8
        , lastbuyprice_withTax = 490, meanbuyprice_withTax = 490, lastbuyprice_withDiscountAndTax = 450.8
                where buybilldetailid = 1762;
UPDATE productunit SET proUnitBuyPrice  = 490 * productnumber WHERE productid = 2416;
UPDATE storedetail SET  productquantity = '30', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3811';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2416', '1', '30', '0', '328', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '5', '2026-10-22 11:35:19','0','0'); -- id=16586
UPDATE supplier SET  suppliercurrentDebt = '126916',suppliercurrentDebtInCurrency= '126916' , userid = '5', supplierdate = '2026-10-22 11:36:30'   WHERE supplierid = '144';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('144', '96832.00', '30084', '0', 'اضافة فاتورة مشتريات', '328', '126916', '2026-10-22 11:35:19', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','30084','1','96832','30084','126916','0',''); -- id=875
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30084', '30084', '2026-10-22', '5', '0', '0', '2026-10-22 11:36:30','اضافة فاتورة مشتريات رقم 328','1','0',null,'0','328','buyBillController.php?do=details&id=328'); -- id=4432
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4432', '382', '30084', '','0'); -- id=4551
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26539909.54', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4432', '627', '30084', '','0'); -- id=4434
UPDATE accountstree SET name = 'بوينت وان', customName = 'بوينت وان', customNameEn = 'بوينت وان', nameEn = 'بوينت وان', parent = '81', accountNature = '1', theValue = '126916', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:24:22' WHERE id = '627';
update buybill set dailyentryid='4432,0' where buybillid=328;
COMMIT;
UPDATE product SET overAllAveragePrice = 552 WHERE productId = 2415;UPDATE product SET overAllAveragePrice = 450.8 WHERE productId = 2416;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:36:30', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=328'); -- id=18017
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:36:33', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=328&type=2'); -- id=18018
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:36:51', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=328'); -- id=18019
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:06:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:36:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:36:57', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=328&type=2'); -- id=18020
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:37:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:37:49', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18021
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 126 فيرست لاين','','211','530','530','0','0','2026-10-22','0','7','0','','0','0','0','0','0','530','530','530','530','530','0','0','0','0','.','0','0','0','530','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','530','530','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','530','0','0','0','0','0','0','','','0','0','0','0'); -- id=2417
UPDATE product SET productName = 'موديل 126 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '530', productSellAllPrice = '530', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02417',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2417';
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', '2417', '1.00', '2026-10-22', '7', '0','0241701','530','0','0','530','','0','0','0','0','0','0','0','0','0','0'); -- id=2417
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2417', '1', '0', '7', '2026-10-22'); -- id=3812
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2417', '1', '0', '0', '2417', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16587
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2417, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2417, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3599
UPDATE product SET productName = 'موديل 126 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02417',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2417';
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 ('موديل 124 فيرست لاين','','211','500','500','0','0','2026-10-22','0','7','0','','0','0','0','0','0','500','500','500','500','500','0','0','0','0','.','0','0','0','500','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','500','500','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','500','0','0','0','0','0','0','','','0','0','0','0'); -- id=2418
UPDATE product SET productName = 'موديل 124 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '500', productSellAllPrice = '500', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02418',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2418';
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', '2418', '1.00', '2026-10-22', '7', '0','0241801','500','0','0','500','','0','0','0','0','0','0','0','0','0','0'); -- id=2418
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2418', '1', '0', '7', '2026-10-22'); -- id=3813
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2418', '1', '0', '0', '2418', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16588
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2418, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2418, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3600
UPDATE product SET productName = 'موديل 124 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02418',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '500',meanbuyprice = '500',meanbuyprice_withDiscount = '500' , productbuypricereal = '500' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='500',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2418';
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 ('موديل 123 فيرست لاين','','211','570','570','0','0','2026-10-22','0','7','0','','0','0','0','0','0','570','570','570','570','570','0','0','0','0','.','0','0','0','570','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','570','570','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','570','0','0','0','0','0','0','','','0','0','0','0'); -- id=2419
UPDATE product SET productName = 'موديل 123 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '570', productSellAllPrice = '570', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02419',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '570',lastbuyprice_withDiscount = '570',meanbuyprice = '570',meanbuyprice_withDiscount = '570' , productbuypricereal = '570' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='570',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='570',meanbuyprice_withTax='570',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='570',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2419';
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', '2419', '1.00', '2026-10-22', '7', '0','0241901','570','0','0','570','','0','0','0','0','0','0','0','0','0','0'); -- id=2419
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2419', '1', '0', '7', '2026-10-22'); -- id=3814
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2419', '1', '0', '0', '2419', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16589
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2419, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2419, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3601
UPDATE product SET productName = 'موديل 123 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '570.00', productSellAllPrice = '570.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02419',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '570',lastbuyprice_withDiscount = '570',meanbuyprice = '570',meanbuyprice_withDiscount = '570' , productbuypricereal = '570' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='570',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='570',meanbuyprice_withTax='570',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='570',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2419';
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 ('موديل 125 فيرست لاين','','211','520','520','0','0','2026-10-22','0','7','0','','0','0','0','0','0','520','520','520','520','520','0','0','0','0','.','0','0','0','520','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','520','520','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','520','0','0','0','0','0','0','','','0','0','0','0'); -- id=2420
UPDATE product SET productName = 'موديل 125 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '520', productSellAllPrice = '520', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02420',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2420';
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', '2420', '1.00', '2026-10-22', '7', '0','0242001','520','0','0','520','','0','0','0','0','0','0','0','0','0','0'); -- id=2420
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2420', '1', '0', '7', '2026-10-22'); -- id=3815
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2420', '1', '0', '0', '2420', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16590
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2420, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2420, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3602
UPDATE product SET productName = 'موديل 125 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02420',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '520',meanbuyprice = '520',meanbuyprice_withDiscount = '520' , productbuypricereal = '520' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='520',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2420';
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 ('موديل 121 فيرست لاين','','211','550','550','0','0','2026-10-22','0','7','0','','0','0','0','0','0','550','550','550','550','550','0','0','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=2421
UPDATE product SET productName = 'موديل 121 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '550', productSellAllPrice = '550', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02421',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2421';
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', '2421', '1.00', '2026-10-22', '7', '0','0242101','550','0','0','550','','0','0','0','0','0','0','0','0','0','0'); -- id=2421
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2421', '1', '0', '7', '2026-10-22'); -- id=3816
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2421', '1', '0', '0', '2421', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16591
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2421, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2421, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3603
UPDATE product SET productName = 'موديل 121 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02421',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2421';
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 122 فيرست لاين','','211','450','450','0','0','2026-10-22','0','7','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2422
UPDATE product SET productName = 'موديل 122 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02422',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2422';
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', '2422', '1.00', '2026-10-22', '7', '0','0242201','450','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2422
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2422', '1', '0', '7', '2026-10-22'); -- id=3817
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2422', '1', '0', '0', '2422', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16592
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2422, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2422, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3604
UPDATE product SET productName = 'موديل 122 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02422',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2422';
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 ('موديل 127 فيرست لاين','','211','600','600','0','0','2026-10-22','0','7','0','','0','0','0','0','0','600','600','600','600','600','0','0','0','0','.','0','0','0','600','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','600','600','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','600','0','0','0','0','0','0','','','0','0','0','0'); -- id=2423
UPDATE product SET productName = 'موديل 127 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '600', productSellAllPrice = '600', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02423',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2423';
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', '2423', '1.00', '2026-10-22', '7', '0','0242301','600','0','0','600','','0','0','0','0','0','0','0','0','0','0'); -- id=2423
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2423', '1', '0', '7', '2026-10-22'); -- id=3818
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2423', '1', '0', '0', '2423', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16593
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2423, 1,'2026-10-22 11:37:49',7)
                ON DUPLICATE KEY UPDATE productid = 2423, edited = 1, sysdate = '2026-10-22 11:37:49', userid = 7; -- id=3605
UPDATE product SET productName = 'موديل 127 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '600.00', productSellAllPrice = '600.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02423',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '600',meanbuyprice = '600',meanbuyprice_withDiscount = '600' , productbuypricereal = '600' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='600',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='600',meanbuyprice_withTax='600',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='600',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2423';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:37:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:37:51', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18022
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:37:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:37:51', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18023
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:37:51", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:37:51', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18024
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:56";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:07:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:37:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:37:58', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=328&type=2'); -- id=18025
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:04", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:38:04', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18026
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:04";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:38:04', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18027
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:06";
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('فيرست لاين', '', '', '', '', '0', '7', '2026-10-22 11:38:12', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=205
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 ('205', '0', '', '0', 'إضافة مورد جديد', '205', '', '2026-10-22 11:38:12', '7', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=876
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('فيرست لاين', 'فيرست لاين', 'فيرست لاين', 'فيرست لاين', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '7', '0', '2026-10-22 11:38:12'); -- id=692
UPDATE supplier SET suppliername = 'فيرست لاين', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '7', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='692',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '205';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:38:15', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18028
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:23", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-22 11:38:23', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=18029
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:38:27', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18030
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:42", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-22 11:38:42', '1', 'show', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=18031
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:38:46', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18032
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:08:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:38:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:38:46', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18033
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:09:29";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:09:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:39:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:39:43', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18034
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 ('06ad9cb5fbca72', '2026-10-22 11:37:51', '205', '0.00', '105873.6', '8', '1', '115080.00',  '105873.60', '0', '105873.6', '1', '2026-10-22 11:39:43', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=329
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 ('02417', '329', '211', '2417', '32', '530', '16960.00', '0', '', '2026-10-22 11:39:43', '2417','','','0','0','0','0','0',null,'530','16960','0','0','0','0','0','0','0','0','1'); -- id=1763
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2417, 0, 0
                    , 487.6, 32, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 487.6,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7089
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2417', '530', '32', '0', 'buyBillController.php', '1763', '', '0', '0'); -- id=1309
UPDATE product SET  productBuyPrice = "530" WHERE productId = 2417 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1763 ;
UPDATE product SET productName = 'موديل 126 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '530.00', productSellAllPrice = '530.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02417',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '487.6',meanbuyprice = '530',meanbuyprice_withDiscount = '487.6' , productbuypricereal = '530.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='487.6',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2417';
UPDATE buybilldetail SET  lastbuyprice = 530 , meanbuyprice = 530, lastbuyprice_withDiscount = 487.6, meanbuyprice_withDiscount = 487.6
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 487.6
                where buybilldetailid = 1763;
UPDATE productunit SET proUnitBuyPrice  = 530 * productnumber WHERE productid = 2417;
UPDATE storedetail SET  productquantity = '32', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3812';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2417', '1', '32', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '7', '2026-10-22 11:37:51','0','0'); -- id=16594
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 ('02418', '329', '211', '2418', '32', '500', '16000.00', '0', '', '2026-10-22 11:39:43', '2418','','','0','0','0','0','0',null,'500','16000','0','0','0','0','0','0','0','0','1'); -- id=1764
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2418, 0, 0
                    , 460, 32, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 460,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7090
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2418', '500', '32', '0', 'buyBillController.php', '1764', '', '0', '0'); -- id=1310
UPDATE product SET  productBuyPrice = "500" WHERE productId = 2418 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1764 ;
UPDATE product SET productName = 'موديل 124 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '500.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02418',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '500',lastbuyprice_withDiscount = '460',meanbuyprice = '500',meanbuyprice_withDiscount = '460' , productbuypricereal = '500.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='500',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='500',meanbuyprice_withTax='500',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2418';
UPDATE buybilldetail SET  lastbuyprice = 500 , meanbuyprice = 500, lastbuyprice_withDiscount = 460, meanbuyprice_withDiscount = 460
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 460
                where buybilldetailid = 1764;
UPDATE productunit SET proUnitBuyPrice  = 500 * productnumber WHERE productid = 2418;
UPDATE storedetail SET  productquantity = '32', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3813';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2418', '1', '32', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '7', '2026-10-22 11:37:51','0','0'); -- id=16595
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 ('02419', '329', '211', '2419', '32', '570', '18240.00', '0', '', '2026-10-22 11:39:43', '2419','','','0','0','0','0','0',null,'570','18240','0','0','0','0','0','0','0','0','1'); -- id=1765
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2419, 0, 0
                    , 524.4, 32, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 524.4,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7091
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2419', '570', '32', '0', 'buyBillController.php', '1765', '', '0', '0'); -- id=1311
UPDATE product SET  productBuyPrice = "570" WHERE productId = 2419 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1765 ;
UPDATE product SET productName = 'موديل 123 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '570.00', productSellAllPrice = '570.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02419',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '570',lastbuyprice_withDiscount = '524.4',meanbuyprice = '570',meanbuyprice_withDiscount = '524.4' , productbuypricereal = '570.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='570',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='570',meanbuyprice_withTax='570',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='524.4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2419';
UPDATE buybilldetail SET  lastbuyprice = 570 , meanbuyprice = 570, lastbuyprice_withDiscount = 524.4, meanbuyprice_withDiscount = 524.4
        , lastbuyprice_withTax = 570, meanbuyprice_withTax = 570, lastbuyprice_withDiscountAndTax = 524.4
                where buybilldetailid = 1765;
UPDATE productunit SET proUnitBuyPrice  = 570 * productnumber WHERE productid = 2419;
UPDATE storedetail SET  productquantity = '32', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3814';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2419', '1', '32', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '7', '2026-10-22 11:37:51','0','0'); -- id=16596
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 ('02420', '329', '211', '2420', '24', '520', '12480.00', '0', '', '2026-10-22 11:39:43', '2420','','','0','0','0','0','0',null,'520','12480','0','0','0','0','0','0','0','0','1'); -- id=1766
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2420, 0, 0
                    , 478.4, 24, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 478.4,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7092
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2420', '520', '24', '0', 'buyBillController.php', '1766', '', '0', '0'); -- id=1312
UPDATE product SET  productBuyPrice = "520" WHERE productId = 2420 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1766 ;
UPDATE product SET productName = 'موديل 125 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '520.00', productSellAllPrice = '520.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02420',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '520',lastbuyprice_withDiscount = '478.4',meanbuyprice = '520',meanbuyprice_withDiscount = '478.4' , productbuypricereal = '520.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='520',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='520',meanbuyprice_withTax='520',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='478.4',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2420';
UPDATE buybilldetail SET  lastbuyprice = 520 , meanbuyprice = 520, lastbuyprice_withDiscount = 478.4, meanbuyprice_withDiscount = 478.4
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 478.4
                where buybilldetailid = 1766;
UPDATE productunit SET proUnitBuyPrice  = 520 * productnumber WHERE productid = 2420;
UPDATE storedetail SET  productquantity = '24', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3815';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2420', '1', '24', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '7', '2026-10-22 11:37:51','0','0'); -- id=16597
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 ('02421', '329', '211', '2421', '28', '550', '15400.00', '0', '', '2026-10-22 11:39:43', '2421','','','0','0','0','0','0',null,'550','15400','0','0','0','0','0','0','0','0','1'); -- id=1767
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2421, 0, 0
                    , 506, 28, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 506,
                        buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7093
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2421', '550', '28', '0', 'buyBillController.php', '1767', '', '0', '0'); -- id=1313
UPDATE product SET  productBuyPrice = "550" WHERE productId = 2421 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1767 ;
UPDATE product SET productName = 'موديل 121 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02421',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '506',meanbuyprice = '550',meanbuyprice_withDiscount = '506' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='506',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2421';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 506, meanbuyprice_withDiscount = 506
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 506
                where buybilldetailid = 1767;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 2421;
UPDATE storedetail SET  productquantity = '28', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3816';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2421', '1', '28', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '28', '7', '2026-10-22 11:37:51','0','0'); -- id=16598
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 ('02422', '329', '211', '2422', '32', '450', '14400.00', '0', '', '2026-10-22 11:39:43', '2422','','','0','0','0','0','0',null,'450','14400','0','0','0','0','0','0','0','0','1'); -- id=1768
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2422, 0, 0
                    , 414, 32, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 414,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7094
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2422', '450', '32', '0', 'buyBillController.php', '1768', '', '0', '0'); -- id=1314
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2422 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1768 ;
UPDATE product SET productName = 'موديل 122 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02422',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '414',meanbuyprice = '450',meanbuyprice_withDiscount = '414' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='414',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2422';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 414, meanbuyprice_withDiscount = 414
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 414
                where buybilldetailid = 1768;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2422;
UPDATE storedetail SET  productquantity = '32', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3817';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2422', '1', '32', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '32', '7', '2026-10-22 11:37:51','0','0'); -- id=16599
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 ('02423', '329', '211', '2423', '36', '600', '21600.00', '0', '', '2026-10-22 11:39:43', '2423','','','0','0','0','0','0',null,'600','21600','0','0','0','0','0','0','0','0','1'); -- id=1769
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:37:51', 1, 2423, 0, 0
                    , 552, 36, 0, 0, 7, '2026-10-22 11:39:43')
                ON DUPLICATE KEY UPDATE buyprice = 552,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:39:43' ; -- id=7095
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2423', '600', '36', '0', 'buyBillController.php', '1769', '', '0', '0'); -- id=1315
UPDATE product SET  productBuyPrice = "600" WHERE productId = 2423 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1769 ;
UPDATE product SET productName = 'موديل 127 فيرست لاين', productDescription = '', productCatId = '211', productBuyPrice = '600.00', productSellAllPrice = '600.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02423',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600',lastbuyprice_withDiscount = '552',meanbuyprice = '600',meanbuyprice_withDiscount = '552' , productbuypricereal = '600.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='600',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='600',meanbuyprice_withTax='600',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='552',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2423';
UPDATE buybilldetail SET  lastbuyprice = 600 , meanbuyprice = 600, lastbuyprice_withDiscount = 552, meanbuyprice_withDiscount = 552
        , lastbuyprice_withTax = 600, meanbuyprice_withTax = 600, lastbuyprice_withDiscountAndTax = 552
                where buybilldetailid = 1769;
UPDATE productunit SET proUnitBuyPrice  = 600 * productnumber WHERE productid = 2423;
UPDATE storedetail SET  productquantity = '36', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3818';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2423', '1', '36', '0', '329', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '7', '2026-10-22 11:37:51','0','0'); -- id=16600
UPDATE supplier SET  suppliercurrentDebt = '105873.6',suppliercurrentDebtInCurrency= '105873.6' , userid = '7', supplierdate = '2026-10-22 11:39:43'   WHERE supplierid = '205';
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 ('205', '0.00', '105873.6', '0', 'اضافة فاتورة مشتريات', '329', '105873.6', '2026-10-22 11:37:51', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','105873.6','1','0','105873.6','105873.6','0',''); -- id=877
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '105873.6', '105873.6', '2026-10-22', '7', '0', '0', '2026-10-22 11:39:43','اضافة فاتورة مشتريات رقم 329','1','0',null,'0','329','buyBillController.php?do=details&id=329'); -- id=4433
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4433', '382', '105873.6', '','0'); -- id=4552
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26645783.14', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4433', '692', '105873.6', '','0'); -- id=4435
UPDATE accountstree SET name = 'فيرست لاين', customName = 'فيرست لاين', customNameEn = 'فيرست لاين', nameEn = 'فيرست لاين', parent = '81', accountNature = '1', theValue = '105873.6', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 11:38:12' WHERE id = '692';
update buybill set dailyentryid='4433,0' where buybillid=329;
COMMIT;
UPDATE product SET overAllAveragePrice = 487.6 WHERE productId = 2417;UPDATE product SET overAllAveragePrice = 460 WHERE productId = 2418;UPDATE product SET overAllAveragePrice = 524.4 WHERE productId = 2419;UPDATE product SET overAllAveragePrice = 478.4 WHERE productId = 2420;UPDATE product SET overAllAveragePrice = 506 WHERE productId = 2421;UPDATE product SET overAllAveragePrice = 414 WHERE productId = 2422;UPDATE product SET overAllAveragePrice = 552 WHERE productId = 2423;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:09:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:39:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:39:43', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=329'); -- id=18035
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:09:44";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:09:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:39:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:39:48', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=329&type=2'); -- id=18036
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:10:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:40:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:40:07', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18037

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9caf8db336
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:40:07', '06ad9caf8db336', '1', '0.00', '0', '0', '1', '5430.00', '5430', '5430', '0', '2', '2026-10-22 11:40:07', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '7' ,'0','','','','','-1','0','0','0','0','0','5430','0','','0','0','5430','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1268
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1268', '0', '2026-10-22 11:40:07', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5430', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:40:07','0','0','',''); -- id=1498
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6311;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','02115', '1268', '181', '2115', '3', '850', '2550', '0', '', '0', '2026-10-22 11:40:07', '2115', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6311-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=5081
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5081;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2115, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '4', storedetaildate = '2026-10-22 11:40:07' WHERE storedetailid = '3552';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2115', '2', '3', '1', '1268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '32', '4', '2026-10-22 11:40:07','0','0'); -- id=16601
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6263;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('648','02162', '1268', '99', '2162', '4', '720', '2880', '0', '', '0', '2026-10-22 11:40:07', '2162', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6263-4,','1','1','0','0','720','2880','0','','0','0.00','0','0','0','0'); -- id=5082
UPDATE sellbilldetail SET  lastbuyprice = 720.00 , meanbuyprice = 720.00, lastbuyprice_withDiscount = 648.00, meanbuyprice_withDiscount = 648.00
        , lastbuyprice_withTax = 720, meanbuyprice_withTax = 720, lastbuyprice_withDiscountAndTax = 648
                where sellbilldetailid = 5082;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2162, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2592, 2592, 2592
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2592, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2592
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '4', storedetaildate = '2026-10-22 11:40:07' WHERE storedetailid = '3529';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2162', '2', '4', '1', '1268', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '0', '4', '2026-10-22 11:40:07','0','0'); -- id=16602
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1239422.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1233992.875','5430', '0', '3', 'اضافة فاتورة مبيعات', '1268', '1239422.875', '2026-10-22 11:40:07', '4',  'sellbillController.php','1','','0'); -- id=1572
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5430', '5430', '2026-10-22', '4', '0', '0', '2026-10-22 11:40:07','اضافة فاتورة مبيعات رقم 1268','1','0',null,'0','1268','sellbillController.php?do=showDetail&sellbillid=1268'); -- id=4434
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4434', '501', '5430', '','0'); -- id=4553
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1239422.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4434', '143', '5430', '','0'); -- id=4436
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14359155', 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 ( '4992', '4992', '2026-10-22', '4', '0', '0', '2026-10-22 11:40:07','اضافة فاتورة مبيعات رقم 1268 - صرف البضاعة من المخزن','1','0',null,'0','1268','sellbillController.php?do=showDetail&sellbillid=1268'); -- id=4435
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4435', '402', '4992', '','0'); -- id=4554
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13280620.06', 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 ('4435', '492', '4992', '','0'); -- id=4437
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1513156', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4434,0,4435' where sellbillid=1268;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 5430, 5280, 5280
                    , 5280, 4992, 4992, 4992
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5430, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4992, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4992
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4992
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5430, 5280, 5280
                    , 5280, 4992, 4992, 4992
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5280, 5280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5430, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4992, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4992
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4992
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 5430, 5280, 5280
                    , 5280, 4992, 4992, 4992, 5280, 5280)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5430, netSellCostBuyPrice = netSellCostBuyPrice+5280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5280
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4992
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4992
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4992
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5280;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9caf8db336 and sellbillId = 1268 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:10:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:40:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:40:08', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18038
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:10:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:40:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:40:53', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18039
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:11:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:41:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:41:38', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=329&type=2'); -- id=18040
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:12:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:42:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:42:08', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18041

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ca062f6ee
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:42:08', '06ad9ca062f6ee', '1', '0.00', '0', '0', '1', '30540.00', '30540', '30540', '0', '1', '2026-10-22 11:42:08', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '66' ,'0','','','','','-1','0','0','0','0','0','30540','0','','0','0','30540','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1269
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1269', '0', '2026-10-22 11:42:08', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '30540', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:42:08','0','0','',''); -- id=1499
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 992;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01898', '1269', '149', '1898', '6', '480', '2880', '0', '', '0', '2026-10-22 11:42:08', '1898', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','992-6,','1','1','0','0','480','2880','0','','0','0.00','0','0','0','0'); -- id=5083
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 445.09
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 436.36, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5083;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1898, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2649.6, 2670.54, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2880, 2618.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2670.54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2618.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2649.6, 2670.54, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2618.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2670.54
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2618.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '2915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1898', '1', '6', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '27', '3', '2026-10-22 11:42:08','0','0'); -- id=16603
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6904;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','02333', '1269', '158', '2333', '8', '440', '3520', '0', '', '0', '2026-10-22 11:42:08', '2333', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6904-8,','1','1','0','0','440','3520','0','','0','0.00','0','0','0','0'); -- id=5084
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 5084;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2333, '2026-10-22', 3520, 3520, 3520
                    , 3520, 3238.4, 3238.4, 3238.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3520, 3520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3520, sellCostBuyPrice =sellCostBuyPrice+3520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3238.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3238.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3238.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3520, 3520, 3520
                    , 3520, 3238.4, 3238.4, 3238.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3520, 3520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3520, sellCostBuyPrice =sellCostBuyPrice+3520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3238.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3238.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3238.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '3727';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2333', '1', '8', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '8', '3', '2026-10-22 11:42:08','0','0'); -- id=16604
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 996;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','01902', '1269', '149', '1902', '6', '450', '2700', '0', '', '0', '2026-10-22 11:42:08', '1902', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','996-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5085
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 414.00, meanbuyprice_withDiscount = 432.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 414
                where sellbilldetailid = 5085;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1902, '2026-10-22', 2700, 2700, 2700
                    , 2700, 2484, 2592, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2700, 2700
                    , 2700, 2484, 2592, 2484
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2484, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2592
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2484
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '2919';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1902', '1', '6', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '3', '2026-10-22 11:42:08','0','0'); -- id=16605
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 35;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','01330', '1269', '37', '1330', '5', '600', '3000', '0', '', '0', '2026-10-22 11:42:08', '1330', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','35-5,','1','1','0','0','600','3000','0','','0','0.00','0','0','0','0'); -- id=5086
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5086;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1330, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2900, 2900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2900, 2900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '1330';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1330', '1', '5', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '30', '3', '2026-10-22 11:42:08','0','0'); -- id=16606
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 1176;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('500','01978', '1269', '37', '1978', '5', '520', '2600', '0', '', '0', '2026-10-22 11:42:08', '1978', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1176-5,','1','1','0','0','520','2600','0','','0','0.00','0','0','0','0'); -- id=5087
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 500.00, meanbuyprice_withDiscount = 500.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 500
                where sellbilldetailid = 5087;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1978, '2026-10-22', 2600, 2500, 2500
                    , 2500, 2500, 2500, 2500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2500, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2600, sellCostBuyPrice =sellCostBuyPrice+2500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2600, 2500, 2500
                    , 2500, 2500, 2500, 2500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2500, 1250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2600, sellCostBuyPrice =sellCostBuyPrice+2500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '35', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '2995';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1978', '1', '5', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '40', '35', '3', '2026-10-22 11:42:08','0','0'); -- id=16607
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','09714', '1269', '11', '770', '5', '455', '2275', '0', '', '0', '2026-10-22 11:42:08', '770', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','455','2275','0','','0','0.00','0','0','0','0'); -- id=5088
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5088;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (770, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '264', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('770', '1', '5', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '269', '264', '3', '2026-10-22 11:42:08','0','0'); -- id=16608
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','09714', '1269', '11', '770', '5', '455', '2275', '0', '', '0', '2026-10-22 11:42:08', '770', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','455','2275','0','','0','0.00','0','0','0','0'); -- id=5089
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5089;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (770, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '259', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('770', '1', '5', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '264', '259', '3', '2026-10-22 11:42:08','0','0'); -- id=16609
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6709;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','00030', '1269', '40', '1121', '5', '290', '1450', '0', '', '0', '2026-10-22 11:42:08', '1121', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6709-5,','1','1','0','0','290','1450','0','','0','0.00','0','0','0','0'); -- id=5090
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.23, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.23
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260.23, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 5090;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1121, '2026-10-22', 1450, 1300, 1300
                    , 1301.15, 1300, 1301.15, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 1300, 1301.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1301.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1301.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1301.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1450, 1300, 1300
                    , 1301.15, 1300, 1301.15, 1300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1300, 1301.15, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1450, sellCostBuyPrice =sellCostBuyPrice+1300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1301.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1301.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1301.15
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '629', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '1121';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1121', '1', '5', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '634', '629', '3', '2026-10-22 11:42:08','0','0'); -- id=16610
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1269', '153', '1919', '9', '450', '4050', '0', '', '0', '2026-10-22 11:42:08', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5091
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5091;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 4050, 3825, 3825
                    , 3825, 3825, 3825, 3825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3825, 3825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4050, 3825, 3825
                    , 3825, 3825, 3825, 3825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3825, 3825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '61', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '9', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '70', '61', '3', '2026-10-22 11:42:08','0','0'); -- id=16611
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7026;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','02379', '1269', '153', '2379', '6', '495', '2970', '0', '', '0', '2026-10-22 11:42:08', '2379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7026-6,','1','1','0','0','495','2970','0','','0','0.00','0','0','0','0'); -- id=5092
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5092;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2379, '2026-10-22', 2970, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2970, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '3773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2379', '1', '6', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '51', '3', '2026-10-22 11:42:08','0','0'); -- id=16612
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1269', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 11:42:08', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=5093
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5093;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '398', userid = '3', storedetaildate = '2026-10-22 11:42:08' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1269', 'اضافة فاتورة مبيعات', 'sellbillController.php', '404', '398', '3', '2026-10-22 11:42:08','0','0'); -- id=16613
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7978873.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7948333.5','30540', '0', '2', 'اضافة فاتورة مبيعات', '1269', '7978873.5', '2026-10-22 11:42:08', '3',  'sellbillController.php','1','','0'); -- id=1573
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30540', '30540', '2026-10-22', '3', '0', '0', '2026-10-22 11:42:08','اضافة فاتورة مبيعات رقم 1269','1','0',null,'0','1269','sellbillController.php?do=showDetail&sellbillid=1269'); -- id=4436
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4436', '419', '30540', '','0'); -- id=4555
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7978873', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4436', '143', '30540', '','0'); -- id=4438
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14389695', 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 ( '28767', '28767', '2026-10-22', '3', '0', '0', '2026-10-22 11:42:08','اضافة فاتورة مبيعات رقم 1269 - صرف البضاعة من المخزن','1','0',null,'0','1269','sellbillController.php?do=showDetail&sellbillid=1269'); -- id=4437
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4437', '402', '28767', '','0'); -- id=4556
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13309387.06', 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 ('4437', '382', '28767', '','0'); -- id=4439
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26617016.14', 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='4436,0,4437' where sellbillid=1269;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 30540, 29495, 29495
                    , 29496.15, 28767, 28897.09, 28767
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29495, 26634.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30540, sellCostBuyPrice =sellCostBuyPrice+29495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29496.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28767, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28897.09
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28767
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29495
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26634.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 30540, 29495, 29495
                    , 29496.15, 28767, 28897.09, 28767
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29495, 26634.31, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30540, sellCostBuyPrice =sellCostBuyPrice+29495
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29495, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29496.15
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28767, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28897.09
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28767
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29495
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26634.31
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 30540, 29495, 29495
                    , 29496.15, 28767, 28897.09, 28767, 29495, 26634.31)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+30540, netSellCostBuyPrice = netSellCostBuyPrice+29495
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+29495
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+29496.15
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+28767
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+28897.09
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+28767
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+29495
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+26634.31;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ca062f6ee and sellbillId = 1269 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:12:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:42:08", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:42:08', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18042
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:45:31', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18043
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:45:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18044
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:45:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18045
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:45:46', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18046

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cc609eaaa
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:45:46', '06ad9cc609eaaa', '1', '0.00', '0', '0', '1', '6000.00', '6000', '6000', '0', '1', '2026-10-22 11:45:46', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','6000','0','','0','0','6000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1270
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1270', '0', '2026-10-22 11:45:46', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:45:46','0','0','',''); -- id=1500
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1270', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 11:45:46', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5094
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5094;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '353', userid = '3', storedetaildate = '2026-10-22 11:45:46' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '359', '353', '3', '2026-10-22 11:45:46','0','0'); -- id=16614
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 978;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('429','01884', '1270', '147', '1884', '3', '460', '1380', '0', '', '0', '2026-10-22 11:45:46', '1884', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','978-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=5095
UPDATE sellbilldetail SET  lastbuyprice = 429.00 , meanbuyprice = 429.00, lastbuyprice_withDiscount = 429.00, meanbuyprice_withDiscount = 429.00
        , lastbuyprice_withTax = 429, meanbuyprice_withTax = 429, lastbuyprice_withDiscountAndTax = 429
                where sellbilldetailid = 5095;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1884, '2026-10-22', 1380, 1287, 1287
                    , 1287, 1287, 1287, 1287
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1287, 1287, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1287
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1287, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1287
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1287, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1287
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1287
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1287
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1287
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1380, 1287, 1287
                    , 1287, 1287, 1287, 1287
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1287, 1287, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1287
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1287, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1287
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1287, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1287
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1287
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1287
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1287
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '171', userid = '3', storedetaildate = '2026-10-22 11:45:46' WHERE storedetailid = '2901';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1884', '1', '3', '1', '1270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '174', '171', '3', '2026-10-22 11:45:46','0','0'); -- id=16615
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6765;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1270', '147', '1886', '6', '320', '1920', '0', '', '0', '2026-10-22 11:45:46', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=5096
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5096;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 1920, 1734, 1734
                    , 1734, 1734, 1734, 1734
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1734, 1734, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1734
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1734, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1734
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1734, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1734
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1734
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1734
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1734
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1920, 1734, 1734
                    , 1734, 1734, 1734, 1734
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1734, 1734, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1734
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1734, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1734
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1734, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1734
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1734
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1734
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1734
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '100', userid = '3', storedetaildate = '2026-10-22 11:45:46' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '6', '1', '1270', 'اضافة فاتورة مبيعات', 'sellbillController.php', '106', '100', '3', '2026-10-22 11:45:46','0','0'); -- id=16616
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '7984873.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7978873.5','6000', '0', '2', 'اضافة فاتورة مبيعات', '1270', '7984873.5', '2026-10-22 11:45:46', '3',  'sellbillController.php','1','','0'); -- id=1574
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6000', '6000', '2026-10-22', '3', '0', '0', '2026-10-22 11:45:46','اضافة فاتورة مبيعات رقم 1270','1','0',null,'0','1270','sellbillController.php?do=showDetail&sellbillid=1270'); -- id=4438
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4438', '419', '6000', '','0'); -- id=4557
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '7984873', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4438', '143', '6000', '','0'); -- id=4440
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14395695', 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 ( '5601', '5601', '2026-10-22', '3', '0', '0', '2026-10-22 11:45:46','اضافة فاتورة مبيعات رقم 1270 - صرف البضاعة من المخزن','1','0',null,'0','1270','sellbillController.php?do=showDetail&sellbillid=1270'); -- id=4439
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4439', '402', '5601', '','0'); -- id=4558
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13314988.06', 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 ('4439', '382', '5601', '','0'); -- id=4441
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26611415.14', 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='4438,0,4439' where sellbillid=1270;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6000, 5601, 5601
                    , 5601, 5601, 5601, 5601
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5601, 5601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6000, 5601, 5601
                    , 5601, 5601, 5601, 5601
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5601, 5601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+5601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6000, 5601, 5601
                    , 5601, 5601, 5601, 5601, 5601, 5601)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6000, netSellCostBuyPrice = netSellCostBuyPrice+5601
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5601
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5601
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5601
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5601
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5601
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5601
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5601;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cc609eaaa and sellbillId = 1270 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:45:46', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18047
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:45:46', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18048
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:15:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:45:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:45:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18049
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:16:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:46:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:46:03', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18050
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:16:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:46:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:46:05', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18051
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 122 استوب','','190','350','370','0','0','2026-10-22','0','5','0','','0','0','0','0','0','350','350','350','350','350','0','5.71','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=2424
UPDATE product SET productName = 'موديل 122 استوب', productDescription = '', productCatId = '190', productBuyPrice = '350', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '5.71' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2424';
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', '2424', '1.00', '2026-10-22', '5', '0','0242401','370','0','0','350','','0','0','0','0','0','0','0','0','0','0'); -- id=2424
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2424', '1', '0', '5', '2026-10-22'); -- id=3819
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2424', '1', '0', '0', '2424', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16617
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2424, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2424, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3606
UPDATE product SET productName = 'موديل 122 استوب', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '5.71' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2424';
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 ('موديل 119 استوب ','','190','300','320','0','0','2026-10-22','0','5','0','','0','0','0','0','0','300','300','300','300','300','0','6.67','0','0','.','0','0','0','300','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','300','300','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','300','0','0','0','0','0','0','','','0','0','0','0'); -- id=2425
UPDATE product SET productName = 'موديل 119 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '300', productSellAllPrice = '320', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300' , buypricereal_precentage = '0' , buytotal_precentage = '6.67' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2425';
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', '2425', '1.00', '2026-10-22', '5', '0','0242501','320','0','0','300','','0','0','0','0','0','0','0','0','0','0'); -- id=2425
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2425', '1', '0', '5', '2026-10-22'); -- id=3820
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '0', '0', '2425', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16618
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2425, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2425, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3607
UPDATE product SET productName = 'موديل 119 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '300.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300' , buypricereal_precentage = '0' , buytotal_precentage = '6.67' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2425';
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 ('موديل 142 استوب ','','190','390','410','0','0','2026-10-22','0','5','0','','0','0','0','0','0','390','390','390','390','390','0','5.13','0','0','.','0','0','0','390','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','390','390','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','390','0','0','0','0','0','0','','','0','0','0','0'); -- id=2426
UPDATE product SET productName = 'موديل 142 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '390', productSellAllPrice = '410', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '5.13' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='390',meanbuyprice_withTax='390',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2426';
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', '2426', '1.00', '2026-10-22', '5', '0','0242601','410','0','0','390','','0','0','0','0','0','0','0','0','0','0'); -- id=2426
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2426', '1', '0', '5', '2026-10-22'); -- id=3821
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2426', '1', '0', '0', '2426', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16619
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2426, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2426, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3608
UPDATE product SET productName = 'موديل 142 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '390.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '5.13' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='390',meanbuyprice_withTax='390',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2426';
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 ('موديل 127 استوب ','','190','450','470','0','0','2026-10-22','0','5','0','','0','0','0','0','0','450','450','450','450','450','0','4.44','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2427
UPDATE product SET productName = 'موديل 127 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '450', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2427';
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', '2427', '1.00', '2026-10-22', '5', '0','0242701','470','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2427
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2427', '1', '0', '5', '2026-10-22'); -- id=3822
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2427', '1', '0', '0', '2427', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16620
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2427, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2427, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3609
UPDATE product SET productName = 'موديل 127 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '4.44' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2427';
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 ('موديل 137 استوب ','','190','350','370','0','0','2026-10-22','0','5','0','','0','0','0','0','0','350','350','350','350','350','0','5.71','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=2428
UPDATE product SET productName = 'موديل 137 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '350', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '5.71' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2428';
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', '2428', '1.00', '2026-10-22', '5', '0','0242801','370','0','0','350','','0','0','0','0','0','0','0','0','0','0'); -- id=2428
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2428', '1', '0', '5', '2026-10-22'); -- id=3823
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2428', '1', '0', '0', '2428', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16621
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2428, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2428, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3610
UPDATE product SET productName = 'موديل 137 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '5.71' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2428';
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 ('موديل 145 استوب ','','190','355','375','0','0','2026-10-22','0','5','0','','0','0','0','0','0','355','355','355','355','355','0','5.63','0','0','.','0','0','0','355','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','355','355','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','355','0','0','0','0','0','0','','','0','0','0','0'); -- id=2429
UPDATE product SET productName = 'موديل 145 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '355', productSellAllPrice = '375', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355' , buypricereal_precentage = '0' , buytotal_precentage = '5.63' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2429';
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', '2429', '1.00', '2026-10-22', '5', '0','0242901','375','0','0','355','','0','0','0','0','0','0','0','0','0','0'); -- id=2429
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2429', '1', '0', '5', '2026-10-22'); -- id=3824
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2429', '1', '0', '0', '2429', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16622
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2429, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2429, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3611
UPDATE product SET productName = 'موديل 145 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '355.00', productSellAllPrice = '375.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355' , buypricereal_precentage = '0' , buytotal_precentage = '5.63' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2429';
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 ('موديل 149 استوب ','','190','260','275','0','0','2026-10-22','0','5','0','','0','0','0','0','0','260','260','260','260','260','0','5.77','0','0','.','0','0','0','260','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','260','260','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','260','0','0','0','0','0','0','','','0','0','0','0'); -- id=2430
UPDATE product SET productName = 'موديل 149 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '260', productSellAllPrice = '275', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260' , buypricereal_precentage = '0' , buytotal_precentage = '5.77' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2430';
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', '2430', '1.00', '2026-10-22', '5', '0','0243001','275','0','0','260','','0','0','0','0','0','0','0','0','0','0'); -- id=2430
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2430', '1', '0', '5', '2026-10-22'); -- id=3825
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2430', '1', '0', '0', '2430', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16623
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2430, 1,'2026-10-22 11:46:05',5)
                ON DUPLICATE KEY UPDATE productid = 2430, edited = 1, sysdate = '2026-10-22 11:46:05', userid = 5; -- id=3612
UPDATE product SET productName = 'موديل 149 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260' , buypricereal_precentage = '0' , buytotal_precentage = '5.77' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2430';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:16:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:46:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:46:06', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18052
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:16:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:46:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:46:07', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18053
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:16:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:46:45", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:46:45', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18054
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:47:07', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18055
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:47:33', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18056
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('فالكون','2026-10-22','','93', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=212
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (212, 1,'2026-10-22 11:47:33',7)
                ON DUPLICATE KEY UPDATE catid = 212, edited = 1, sysdate = '2026-10-22 11:47:33', userid = 7; -- id=227
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '212', '1', '2026-10-22', '7', '0'); -- id=102
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:47:33', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18057
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 11:47:35', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18058
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:47:37', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18059
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:37", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:47:37', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18060
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:38";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:47:38", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:47:38', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18061
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:47:39', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18062
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:47:42', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18063
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:47:42', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18064
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:47:45', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18065

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bc11da771
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:47:45', '06ad9bc11da771', '1', '0.00', '0', '0', '1', '22350.00', '22350', '22350', '0', '1', '2026-10-22 11:47:45', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '57' ,'0','','','','','-1','0','0','0','0','0','22350','0','','0','0','22350','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1271
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1271', '0', '2026-10-22 11:47:45', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '22350', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:47:45','0','0','',''); -- id=1501
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6537;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('235','01841', '1271', '142', '1841', '12', '250', '3000', '0', '', '0', '2026-10-22 11:47:45', '1841', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6537-12,','1','1','0','0','250','3000','0','','0','0.00','0','0','0','0'); -- id=5097
UPDATE sellbilldetail SET  lastbuyprice = 235.00 , meanbuyprice = 235.00, lastbuyprice_withDiscount = 235.00, meanbuyprice_withDiscount = 235.00
        , lastbuyprice_withTax = 235, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 235
                where sellbilldetailid = 5097;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1841, '2026-10-22', 3000, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 2820, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2820, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '169', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '2856';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1841', '1', '12', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '181', '169', '2', '2026-10-22 11:47:45','0','0'); -- id=16624
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6915;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.6','02337', '1271', '115', '2337', '6', '455', '2730', '0', '', '0', '2026-10-22 11:47:45', '2337', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6915-6,','1','1','0','0','455','2730','0','','0','0.00','0','0','0','0'); -- id=5098
UPDATE sellbilldetail SET  lastbuyprice = 455.00 , meanbuyprice = 455.00, lastbuyprice_withDiscount = 418.60, meanbuyprice_withDiscount = 418.60
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 418.6
                where sellbilldetailid = 5098;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2337, '2026-10-22', 2730, 2730, 2730
                    , 2730, 2511.6, 2511.6, 2511.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2730, 2730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2511.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2511.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2511.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2730
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2730, 2730, 2730
                    , 2730, 2511.6, 2511.6, 2511.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2730, 2730, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2730
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2730, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2730
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2511.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2511.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2511.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2730
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2730
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '3731';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2337', '1', '6', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '2', '2026-10-22 11:47:45','0','0'); -- id=16625
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1271', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 11:47:45', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5099
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5099;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '347', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '353', '347', '2', '2026-10-22 11:47:45','0','0'); -- id=16626
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1271', '147', '1885', '12', '390', '4680', '0', '', '0', '2026-10-22 11:47:45', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=5100
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5100;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 4680, 4308, 4308
                    , 4308, 4308, 4308, 4308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4308, 4308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4680, 4308, 4308
                    , 4308, 4308, 4308, 4308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4308, 4308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '100', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '12', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '100', '2', '2026-10-22 11:47:45','0','0'); -- id=16627
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1271', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 11:47:45', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=5101
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5101;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '392', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '398', '392', '2', '2026-10-22 11:47:45','0','0'); -- id=16628
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1271', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 11:47:45', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5102
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5102;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '344', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '347', '344', '2', '2026-10-22 11:47:45','0','0'); -- id=16629
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7026;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','02379', '1271', '153', '2379', '6', '495', '2970', '0', '', '0', '2026-10-22 11:47:45', '2379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7026-6,','1','1','0','0','495','2970','0','','0','0.00','0','0','0','0'); -- id=5103
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5103;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2379, '2026-10-22', 2970, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2970, 2820, 2820
                    , 2820, 2820, 2820, 2820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2820, 2820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '3773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2379', '1', '6', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '45', '2', '2026-10-22 11:47:45','0','0'); -- id=16630
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6145;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('325','01922', '1271', '153', '1922', '6', '350', '2100', '0', '', '0', '2026-10-22 11:47:45', '1922', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6145-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5104
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 325.00, meanbuyprice_withDiscount = 325.00
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 325
                where sellbilldetailid = 5104;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1922, '2026-10-22', 2100, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 1950, 1950
                    , 1950, 1950, 1950, 1950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-22 11:47:45' WHERE storedetailid = '2939';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1922', '1', '6', '1', '1271', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '2', '2026-10-22 11:47:45','0','0'); -- id=16631
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8007223.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('7984873.5','22350', '0', '2', 'اضافة فاتورة مبيعات', '1271', '8007223.5', '2026-10-22 11:47:45', '2',  'sellbillController.php','1','','0'); -- id=1575
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '22350', '22350', '2026-10-22', '2', '0', '0', '2026-10-22 11:47:45','اضافة فاتورة مبيعات رقم 1271','1','0',null,'0','1271','sellbillController.php?do=showDetail&sellbillid=1271'); -- id=4440
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4440', '419', '22350', '','0'); -- id=4559
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8007223', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4440', '143', '22350', '','0'); -- id=4442
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14418045', 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 ( '20979.6', '20979.6', '2026-10-22', '2', '0', '0', '2026-10-22 11:47:45','اضافة فاتورة مبيعات رقم 1271 - صرف البضاعة من المخزن','1','0',null,'0','1271','sellbillController.php?do=showDetail&sellbillid=1271'); -- id=4441
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4441', '402', '20979.6', '','0'); -- id=4560
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13335967.66', 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 ('4441', '382', '20979.6', '','0'); -- id=4443
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26590435.54', 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='4440,0,4441' where sellbillid=1271;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 22350, 21198, 21198
                    , 21198, 20979.6, 20979.6, 20979.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,21198, 21138, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22350, sellCostBuyPrice =sellCostBuyPrice+21198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21198
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20979.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20979.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20979.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21138
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 22350, 21198, 21198
                    , 21198, 20979.6, 20979.6, 20979.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,21198, 21138, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+22350, sellCostBuyPrice =sellCostBuyPrice+21198
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+21198, sellCostMeanBuyPrice = sellCostMeanBuyPrice+21198
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20979.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20979.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20979.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+21198
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+21138
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 22350, 21198, 21198
                    , 21198, 20979.6, 20979.6, 20979.6, 21198, 21138)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+22350, netSellCostBuyPrice = netSellCostBuyPrice+21198
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+21198
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+21198
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+20979.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+20979.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+20979.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+21198
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+21138;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bc11da771 and sellbillId = 1271 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:17:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:47:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:47:45', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18066
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:50:13', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18067
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 ('06ad9cd4f37ac8', '2026-10-22 11:46:07', '1', '-3150.00', '104670', '0', '0', '107820.00',  '107820.00', '', '107820', '1', '2026-10-22 11:50:13', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=330
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 ('02176', '330', '190', '2176', '36', '310', '11160.00', '0', '', '2026-10-22 11:50:13', '2176','','','0','0','0','0','0',null,'310','11160','0','0','0','0','0','0','0','0','1'); -- id=1770
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2176, 0, 0
                    , 310, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 310,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7096
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2176', '310', '36', '0', 'buyBillController.php', '1770', '', '0', '0'); -- id=1316
UPDATE product SET  productBuyPrice = "310" WHERE productId = 2176 ;
UPDATE buybilldetail SET  quantitybefore = 56 WHERE buybilldetailid = 1770 ;
UPDATE product SET productName = 'اوفر سايز 330 استوب', productDescription = '', productCatId = '190', productBuyPrice = '310.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02176',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.45' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2176';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 310, meanbuyprice_withDiscount = 310
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where buybilldetailid = 1770;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 2176;
UPDATE storedetail SET  productquantity = '92', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '56', '92', '5', '2026-10-22 11:46:07','0','0'); -- id=16632
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 ('02175', '330', '190', '2175', '36', '230', '8280.00', '0', '', '2026-10-22 11:50:13', '2175','','','0','0','0','0','0',null,'230','8280','0','0','0','0','0','0','0','0','1'); -- id=1771
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2175, 0, 0
                    , 230, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 230,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7097
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2175', '230', '36', '0', 'buyBillController.php', '1771', '', '0', '0'); -- id=1317
UPDATE product SET  productBuyPrice = "230" WHERE productId = 2175 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1771 ;
UPDATE product SET productName = 'تلبيس عادي استوب', productDescription = '', productCatId = '190', productBuyPrice = '230.00', productSellAllPrice = '245.00', productSellUnitPrice = '245.00', productSellHalfPrice = '245.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02175',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '230',lastbuyprice_withDiscount = '230',meanbuyprice = '230',meanbuyprice_withDiscount = '230' , productbuypricereal = '230.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='230',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='230',meanbuyprice_withTax='230',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='230',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2175';
UPDATE buybilldetail SET  lastbuyprice = 230 , meanbuyprice = 230, lastbuyprice_withDiscount = 230, meanbuyprice_withDiscount = 230
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 230
                where buybilldetailid = 1771;
UPDATE productunit SET proUnitBuyPrice  = 230 * productnumber WHERE productid = 2175;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3535';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2175', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16633
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 ('02424', '330', '190', '2424', '36', '350', '12600.00', '0', '', '2026-10-22 11:50:13', '2424','','','0','0','0','0','0',null,'350','12600','0','0','0','0','0','0','0','0','1'); -- id=1772
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2424, 0, 0
                    , 350, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7098
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2424', '350', '36', '0', 'buyBillController.php', '1772', '', '0', '0'); -- id=1318
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2424 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1772 ;
UPDATE product SET productName = 'موديل 122 استوب', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2424';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1772;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2424;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3819';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2424', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16634
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 ('02425', '330', '190', '2425', '36', '300', '10800.00', '0', '', '2026-10-22 11:50:13', '2425','','','0','0','0','0','0',null,'300','10800','0','0','0','0','0','0','0','0','1'); -- id=1773
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2425, 0, 0
                    , 300, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 300,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7099
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2425', '300', '36', '0', 'buyBillController.php', '1773', '', '0', '0'); -- id=1319
UPDATE product SET  productBuyPrice = "300" WHERE productId = 2425 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1773 ;
UPDATE product SET productName = 'موديل 119 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '300.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.67' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2425';
UPDATE buybilldetail SET  lastbuyprice = 300 , meanbuyprice = 300, lastbuyprice_withDiscount = 300, meanbuyprice_withDiscount = 300
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where buybilldetailid = 1773;
UPDATE productunit SET proUnitBuyPrice  = 300 * productnumber WHERE productid = 2425;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16635
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 ('02426', '330', '190', '2426', '36', '390', '14040.00', '0', '', '2026-10-22 11:50:13', '2426','','','0','0','0','0','0',null,'390','14040','0','0','0','0','0','0','0','0','1'); -- id=1774
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2426, 0, 0
                    , 390, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 390,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7100
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2426', '390', '36', '0', 'buyBillController.php', '1774', '', '0', '0'); -- id=1320
UPDATE product SET  productBuyPrice = "390" WHERE productId = 2426 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1774 ;
UPDATE product SET productName = 'موديل 142 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '390.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.13' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='390',meanbuyprice_withTax='390',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2426';
UPDATE buybilldetail SET  lastbuyprice = 390 , meanbuyprice = 390, lastbuyprice_withDiscount = 390, meanbuyprice_withDiscount = 390
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where buybilldetailid = 1774;
UPDATE productunit SET proUnitBuyPrice  = 390 * productnumber WHERE productid = 2426;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3821';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2426', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16636
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 ('02427', '330', '190', '2427', '36', '450', '16200.00', '0', '', '2026-10-22 11:50:13', '2427','','','0','0','0','0','0',null,'450','16200','0','0','0','0','0','0','0','0','1'); -- id=1775
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2427, 0, 0
                    , 450, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7101
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2427', '450', '36', '0', 'buyBillController.php', '1775', '', '0', '0'); -- id=1321
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2427 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1775 ;
UPDATE product SET productName = 'موديل 127 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2427';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1775;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2427;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3822';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2427', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16637
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 ('02428', '330', '190', '2428', '36', '350', '12600.00', '0', '', '2026-10-22 11:50:13', '2428','','','0','0','0','0','0',null,'350','12600','0','0','0','0','0','0','0','0','1'); -- id=1776
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2428, 0, 0
                    , 350, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7102
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2428', '350', '36', '0', 'buyBillController.php', '1776', '', '0', '0'); -- id=1322
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2428 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1776 ;
UPDATE product SET productName = 'موديل 137 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2428';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1776;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2428;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3823';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2428', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16638
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 ('02429', '330', '190', '2429', '36', '355', '12780.00', '0', '', '2026-10-22 11:50:13', '2429','','','0','0','0','0','0',null,'355','12780','0','0','0','0','0','0','0','0','1'); -- id=1777
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2429, 0, 0
                    , 355, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 355,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7103
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2429', '355', '36', '0', 'buyBillController.php', '1777', '', '0', '0'); -- id=1323
UPDATE product SET  productBuyPrice = "355" WHERE productId = 2429 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1777 ;
UPDATE product SET productName = 'موديل 145 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '355.00', productSellAllPrice = '375.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.63' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2429';
UPDATE buybilldetail SET  lastbuyprice = 355 , meanbuyprice = 355, lastbuyprice_withDiscount = 355, meanbuyprice_withDiscount = 355
        , lastbuyprice_withTax = 355, meanbuyprice_withTax = 355, lastbuyprice_withDiscountAndTax = 355
                where buybilldetailid = 1777;
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2429;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3824';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2429', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16639
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 ('02430', '330', '190', '2430', '36', '260', '9360.00', '0', '', '2026-10-22 11:50:13', '2430','','','0','0','0','0','0',null,'260','9360','0','0','0','0','0','0','0','0','1'); -- id=1778
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2430, 0, 0
                    , 260, 36, 0, 0, 5, '2026-10-22 11:50:13')
                ON DUPLICATE KEY UPDATE buyprice = 260,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:50:13' ; -- id=7104
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2430', '260', '36', '0', 'buyBillController.php', '1778', '', '0', '0'); -- id=1324
UPDATE product SET  productBuyPrice = "260" WHERE productId = 2430 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1778 ;
UPDATE product SET productName = 'موديل 149 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.77' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2430';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 260, lastbuyprice_withDiscount = 260, meanbuyprice_withDiscount = 260
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where buybilldetailid = 1778;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 2430;
UPDATE storedetail SET  productquantity = '36', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3825';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2430', '1', '36', '0', '330', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '5', '2026-10-22 11:46:07','0','0'); -- id=16640
UPDATE supplier SET  suppliercurrentDebt = '107820',suppliercurrentDebtInCurrency= '104670' , userid = '5', supplierdate = '2026-10-22 11:50:13'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '0.00', '107820', '0', 'اضافة فاتورة مشتريات', '330', '107820', '2026-10-22 11:46:07', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','107820','1','-3150','107820','104670','0',''); -- id=878
update buybill set dailyentryid='0,0' where buybillid=330;
COMMIT;
UPDATE product SET overAllAveragePrice = 230 WHERE productId = 2175;UPDATE product SET overAllAveragePrice = 310 WHERE productId = 2176;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2424;UPDATE product SET overAllAveragePrice = 300 WHERE productId = 2425;UPDATE product SET overAllAveragePrice = 390 WHERE productId = 2426;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2427;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2428;UPDATE product SET overAllAveragePrice = 355 WHERE productId = 2429;UPDATE product SET overAllAveragePrice = 260 WHERE productId = 2430;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:50:13', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=330'); -- id=18068
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:50:17', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=330&type=2'); -- id=18069
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:50:22', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18070
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('حوض قصات فالكون','','212','370','370','0','0','2026-10-22','0','7','0','','0','0','0','0','0','370','370','370','370','370','0','0','0','0','.','0','0','0','370','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','370','370','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','370','0','0','0','0','0','0','','','0','0','0','0'); -- id=2431
UPDATE product SET productName = 'حوض قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02431',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',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='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2431';
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', '2431', '1.00', '2026-10-22', '7', '0','0243101','370','0','0','370','','0','0','0','0','0','0','0','0','0','0'); -- id=2431
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2431', '1', '0', '7', '2026-10-22'); -- id=3826
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2431', '1', '0', '0', '2431', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16641
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2431, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2431, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3613
UPDATE product SET productName = 'حوض قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02431',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',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='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2431';
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 ('بوكس فيت فالكون','','212','400','400','0','0','2026-10-22','0','7','0','','0','0','0','0','0','400','400','400','400','400','0','0','0','0','.','0','0','0','400','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','400','400','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','400','0','0','0','0','0','0','','','0','0','0','0'); -- id=2432
UPDATE product SET productName = 'بوكس فيت فالكون', productDescription = '', productCatId = '212', productBuyPrice = '400', productSellAllPrice = '400', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02432',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2432';
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', '2432', '1.00', '2026-10-22', '7', '0','0243201','400','0','0','400','','0','0','0','0','0','0','0','0','0','0'); -- id=2432
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2432', '1', '0', '7', '2026-10-22'); -- id=3827
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2432', '1', '0', '0', '2432', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16642
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2432, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2432, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3614
UPDATE product SET productName = 'بوكس فيت فالكون', productDescription = '', productCatId = '212', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02432',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2432';
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 ('بوكس فيت قصات فالكون','','212','370','370','0','0','2026-10-22','0','7','0','','0','0','0','0','0','370','370','370','370','370','0','0','0','0','.','0','0','0','370','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','370','370','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','370','0','0','0','0','0','0','','','0','0','0','0'); -- id=2433
UPDATE product SET productName = 'بوكس فيت قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02433',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2433';
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', '2433', '1.00', '2026-10-22', '7', '0','0243301','370','0','0','370','','0','0','0','0','0','0','0','0','0','0'); -- id=2433
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2433', '1', '0', '7', '2026-10-22'); -- id=3828
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2433', '1', '0', '0', '2433', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16643
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2433, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2433, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3615
UPDATE product SET productName = 'بوكس فيت قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02433',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2433';
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 ('نص سوسته فالكون','','212','380','380','0','0','2026-10-22','0','7','0','','0','0','0','0','0','380','380','380','380','380','0','0','0','0','.','0','0','0','380','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','380','380','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','380','0','0','0','0','0','0','','','0','0','0','0'); -- id=2434
UPDATE product SET productName = 'نص سوسته فالكون', productDescription = '', productCatId = '212', productBuyPrice = '380', productSellAllPrice = '380', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02434',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2434';
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', '2434', '1.00', '2026-10-22', '7', '0','0243401','380','0','0','380','','0','0','0','0','0','0','0','0','0','0'); -- id=2434
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2434', '1', '0', '7', '2026-10-22'); -- id=3829
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2434', '1', '0', '0', '2434', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16644
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2434, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2434, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3616
UPDATE product SET productName = 'نص سوسته فالكون', productDescription = '', productCatId = '212', productBuyPrice = '380.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02434',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2434';
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 ('كابتشوة فالكون','','212','410','410','0','0','2026-10-22','0','7','0','','0','0','0','0','0','410','410','410','410','410','0','0','0','0','.','0','0','0','410','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','410','410','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','410','0','0','0','0','0','0','','','0','0','0','0'); -- id=2435
UPDATE product SET productName = 'كابتشوة فالكون', productDescription = '', productCatId = '212', productBuyPrice = '410', productSellAllPrice = '410', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02435',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2435';
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', '2435', '1.00', '2026-10-22', '7', '0','0243501','410','0','0','410','','0','0','0','0','0','0','0','0','0','0'); -- id=2435
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2435', '1', '0', '7', '2026-10-22'); -- id=3830
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2435', '1', '0', '0', '2435', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16645
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2435, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2435, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3617
UPDATE product SET productName = 'كابتشوة فالكون', productDescription = '', productCatId = '212', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02435',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2435';
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 ('بوكس فيت حوض فالكون','','212','330','330','0','0','2026-10-22','0','7','0','','0','0','0','0','0','330','330','330','330','330','0','0','0','0','.','0','0','0','330','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','330','330','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','330','0','0','0','0','0','0','','','0','0','0','0'); -- id=2436
UPDATE product SET productName = 'بوكس فيت حوض فالكون', productDescription = '', productCatId = '212', productBuyPrice = '330', productSellAllPrice = '330', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02436',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '330',meanbuyprice = '330',meanbuyprice_withDiscount = '330' , productbuypricereal = '330' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='330',meanbuyprice_withTax='330',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='330',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2436';
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', '2436', '1.00', '2026-10-22', '7', '0','0243601','330','0','0','330','','0','0','0','0','0','0','0','0','0','0'); -- id=2436
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2436', '1', '0', '7', '2026-10-22'); -- id=3831
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2436', '1', '0', '0', '2436', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16646
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2436, 1,'2026-10-22 11:50:22',7)
                ON DUPLICATE KEY UPDATE productid = 2436, edited = 1, sysdate = '2026-10-22 11:50:22', userid = 7; -- id=3618
UPDATE product SET productName = 'بوكس فيت حوض فالكون', productDescription = '', productCatId = '212', productBuyPrice = '330.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02436',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '330',meanbuyprice = '330',meanbuyprice_withDiscount = '330' , productbuypricereal = '330' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='330',meanbuyprice_withTax='330',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='330',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2436';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:50:24', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18071
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:20:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:50:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:50:26', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18072
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('فالكون', '', '', '', '', '0', '7', '2026-10-22 11:50:38', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=206
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 ('206', '0', '', '0', 'إضافة مورد جديد', '206', '', '2026-10-22 11:50:38', '7', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=879
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('فالكون', 'فالكون', 'فالكون', 'فالكون', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '7', '0', '2026-10-22 11:50:38'); -- id=693
UPDATE supplier SET suppliername = 'فالكون', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '7', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='693',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '206';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:22:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:52:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:52:09', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18073
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 ('06ad9ce529578b', '2026-10-22 11:50:26', '206', '0.00', '42795', '10', '1', '47550.00',  '42795.00', '0', '42795', '1', '2026-10-22 11:52:09', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=331
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 ('02431', '331', '212', '2431', '18', '370', '6660.00', '0', '', '2026-10-22 11:52:09', '2431','','','0','0','0','0','0',null,'370','6660','0','0','0','0','0','0','0','0','1'); -- id=1779
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2431, 0, 0
                    , 333, 18, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 333,
                        buyQuantity =buyQuantity+18, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7105
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2431', '370', '18', '0', 'buyBillController.php', '1779', '', '0', '0'); -- id=1325
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2431 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1779 ;
UPDATE product SET productName = 'حوض قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02431',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '333',meanbuyprice = '370',meanbuyprice_withDiscount = '333' , productbuypricereal = '370.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='370',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='370',meanbuyprice_withTax='370',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='333',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2431';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 333, meanbuyprice_withDiscount = 333
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where buybilldetailid = 1779;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2431;
UPDATE storedetail SET  productquantity = '18', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3826';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2431', '1', '18', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '18', '7', '2026-10-22 11:50:26','0','0'); -- id=16647
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 ('02432', '331', '212', '2432', '24', '400', '9600.00', '0', '', '2026-10-22 11:52:09', '2432','','','0','0','0','0','0',null,'400','9600','0','0','0','0','0','0','0','0','1'); -- id=1780
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2432, 0, 0
                    , 360, 24, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7106
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2432', '400', '24', '0', 'buyBillController.php', '1780', '', '0', '0'); -- id=1326
UPDATE product SET  productBuyPrice = "400" WHERE productId = 2432 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1780 ;
UPDATE product SET productName = 'بوكس فيت فالكون', productDescription = '', productCatId = '212', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02432',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '360',meanbuyprice = '400',meanbuyprice_withDiscount = '360' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2432';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 360
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 1780;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 2432;
UPDATE storedetail SET  productquantity = '24', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3827';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2432', '1', '24', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '7', '2026-10-22 11:50:26','0','0'); -- id=16648
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 ('02433', '331', '212', '2433', '21', '370', '7770.00', '0', '', '2026-10-22 11:52:09', '2433','','','0','0','0','0','0',null,'370','7770','0','0','0','0','0','0','0','0','1'); -- id=1781
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2433, 0, 0
                    , 333, 21, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 333,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7107
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2433', '370', '21', '0', 'buyBillController.php', '1781', '', '0', '0'); -- id=1327
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2433 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1781 ;
UPDATE product SET productName = 'بوكس فيت قصات فالكون', productDescription = '', productCatId = '212', productBuyPrice = '370.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02433',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '333',meanbuyprice = '370',meanbuyprice_withDiscount = '333' , productbuypricereal = '370.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='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='333',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2433';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 333, meanbuyprice_withDiscount = 333
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where buybilldetailid = 1781;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2433;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3828';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2433', '1', '21', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '7', '2026-10-22 11:50:26','0','0'); -- id=16649
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 ('02434', '331', '212', '2434', '21', '380', '7980.00', '0', '', '2026-10-22 11:52:09', '2434','','','0','0','0','0','0',null,'380','7980','0','0','0','0','0','0','0','0','1'); -- id=1782
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2434, 0, 0
                    , 342, 21, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 342,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7108
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2434', '380', '21', '0', 'buyBillController.php', '1782', '', '0', '0'); -- id=1328
UPDATE product SET  productBuyPrice = "380" WHERE productId = 2434 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1782 ;
UPDATE product SET productName = 'نص سوسته فالكون', productDescription = '', productCatId = '212', productBuyPrice = '380.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02434',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '342',meanbuyprice = '380',meanbuyprice_withDiscount = '342' , productbuypricereal = '380.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='380',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='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='342',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2434';
UPDATE buybilldetail SET  lastbuyprice = 380 , meanbuyprice = 380, lastbuyprice_withDiscount = 342, meanbuyprice_withDiscount = 342
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 342
                where buybilldetailid = 1782;
UPDATE productunit SET proUnitBuyPrice  = 380 * productnumber WHERE productid = 2434;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3829';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2434', '1', '21', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '7', '2026-10-22 11:50:26','0','0'); -- id=16650
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 ('02435', '331', '212', '2435', '21', '410', '8610.00', '0', '', '2026-10-22 11:52:09', '2435','','','0','0','0','0','0',null,'410','8610','0','0','0','0','0','0','0','0','1'); -- id=1783
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2435, 0, 0
                    , 369, 21, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 369,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7109
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2435', '410', '21', '0', 'buyBillController.php', '1783', '', '0', '0'); -- id=1329
UPDATE product SET  productBuyPrice = "410" WHERE productId = 2435 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1783 ;
UPDATE product SET productName = 'كابتشوة فالكون', productDescription = '', productCatId = '212', productBuyPrice = '410.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02435',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '369',meanbuyprice = '410',meanbuyprice_withDiscount = '369' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='369',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2435';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 369, meanbuyprice_withDiscount = 369
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 369
                where buybilldetailid = 1783;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 2435;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3830';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2435', '1', '21', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '7', '2026-10-22 11:50:26','0','0'); -- id=16651
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 ('02436', '331', '212', '2436', '21', '330', '6930.00', '0', '', '2026-10-22 11:52:09', '2436','','','0','0','0','0','0',null,'330','6930','0','0','0','0','0','0','0','0','1'); -- id=1784
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:50:26', 1, 2436, 0, 0
                    , 297, 21, 0, 0, 7, '2026-10-22 11:52:09')
                ON DUPLICATE KEY UPDATE buyprice = 297,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 11:52:09' ; -- id=7110
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2436', '330', '21', '0', 'buyBillController.php', '1784', '', '0', '0'); -- id=1330
UPDATE product SET  productBuyPrice = "330" WHERE productId = 2436 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1784 ;
UPDATE product SET productName = 'بوكس فيت حوض فالكون', productDescription = '', productCatId = '212', productBuyPrice = '330.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02436',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '330',lastbuyprice_withDiscount = '297',meanbuyprice = '330',meanbuyprice_withDiscount = '297' , productbuypricereal = '330.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='330',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='330',meanbuyprice_withTax='330',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='297',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2436';
UPDATE buybilldetail SET  lastbuyprice = 330 , meanbuyprice = 330, lastbuyprice_withDiscount = 297, meanbuyprice_withDiscount = 297
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 330, lastbuyprice_withDiscountAndTax = 297
                where buybilldetailid = 1784;
UPDATE productunit SET proUnitBuyPrice  = 330 * productnumber WHERE productid = 2436;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3831';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2436', '1', '21', '0', '331', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '7', '2026-10-22 11:50:26','0','0'); -- id=16652
UPDATE supplier SET  suppliercurrentDebt = '42795',suppliercurrentDebtInCurrency= '42795' , userid = '7', supplierdate = '2026-10-22 11:52:09'   WHERE supplierid = '206';
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 ('206', '0.00', '42795', '0', 'اضافة فاتورة مشتريات', '331', '42795', '2026-10-22 11:50:26', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','42795','1','0','42795','42795','0',''); -- id=880
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '42795', '42795', '2026-10-22', '7', '0', '0', '2026-10-22 11:52:09','اضافة فاتورة مشتريات رقم 331','1','0',null,'0','331','buyBillController.php?do=details&id=331'); -- id=4442
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4442', '382', '42795', '','0'); -- id=4561
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26633230.54', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4442', '693', '42795', '','0'); -- id=4444
UPDATE accountstree SET name = 'فالكون', customName = 'فالكون', customNameEn = 'فالكون', nameEn = 'فالكون', parent = '81', accountNature = '1', theValue = '42795', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 11:50:38' WHERE id = '693';
update buybill set dailyentryid='4442,0' where buybillid=331;
COMMIT;
UPDATE product SET overAllAveragePrice = 333 WHERE productId = 2431;UPDATE product SET overAllAveragePrice = 360 WHERE productId = 2432;UPDATE product SET overAllAveragePrice = 333 WHERE productId = 2433;UPDATE product SET overAllAveragePrice = 342 WHERE productId = 2434;UPDATE product SET overAllAveragePrice = 369 WHERE productId = 2435;UPDATE product SET overAllAveragePrice = 297 WHERE productId = 2436;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:22:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:52:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:52:10', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=331'); -- id=18074
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:22:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:52:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:52:16', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=331&type=2'); -- id=18075
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:23:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:53:11", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:53:11', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18076

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c9ea9d92d
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c9ea9d92d and sellbillId = 1272 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:23:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:53:11", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:53:11', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18077
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:24:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:54:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:54:56', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=330&type=2'); -- id=18078
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:24:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:54:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:54:59', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=330'); -- id=18079
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:31", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:55:31', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18080
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:44", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:55:44', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18081

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cf83833bb
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 11:55:44', '06ad9cf83833bb', '1', '0.00', '0', '0', '1', '1470', '1470', '-1470', '0', '1', '2026-10-22 11:55:44', '', '6', '0', 'نقدي','4', '0', '5', '0', 'نقدي', '3', '0', '', '','','','-1','0','0','0','','0','-1470','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=44
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','44', '0', '2026-10-22 11:55:44', '6', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1470', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:55:44','0','0','',''); -- id=1503
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('390.00', '02021', '44', '91', '2021', '3', '490', '1470', '0', '', '0', '0', '2021', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','490','1470','0','','0'); -- id=62
UPDATE returnsellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where returnsellbilldetailid = 62;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2021, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1470, 1170, 1170, 1170
                    , 1170, 1170, 1170, 0, 3, 0, 0, 1170, 1170)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1470, returnSellCostBuyPrice = returnSellCostBuyPrice+1170, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1170
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1170, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1170
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1170
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1170
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1170
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1170
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+3;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1470, 1170, 1170, 1170
                    , 1170, 1170, 1170, 0, 0, 1170, 1170)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1470, returnSellCostBuyPrice = returnSellCostBuyPrice+1170, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1170
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1170, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1170
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1170
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1170
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1170
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1170;
UPDATE storedetail SET  productquantity = '219', userid = '6', storedetaildate = '2026-10-22 11:55:44' WHERE storedetailid = '3380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2021', '1', '3', '0', '44', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '216', '219', '6', '2026-10-22 11:55:44','0','0'); -- id=16654
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1196650',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1198120','-1470', '1', '4', 'اضافة فاتورة مردوات مبيعات', '44', '1196650', '2026-10-22 11:55:44', '6',  'returnsellbillController.php','1','','0'); -- id=1577
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1470', '1470', '2026-10-22', '6', '0', '0', '2026-10-22 11:55:44','اضافة فاتورة مردود مبيعات رقم 44','1','0',null,'0','44','returnsellbillController.php?do=showDetail&returnsellbillid=44'); -- id=4445
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4445', '143', '1470', '','0'); -- id=4564
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14417925', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4445', '568', '1470', '','0'); -- id=4447
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1196650', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1170', '1170', '2026-10-22', '6', '0', '0', '2026-10-22 11:55:44','اضافة فاتورة مردود مبيعات رقم 44 - صرف البضاعة من المخزن','1','0',null,'0','44','returnsellbillController.php?do=showDetail&returnsellbillid=44'); -- id=4446
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4446', '382', '1170', '','0'); -- id=4565
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26633140.54', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4446', '402', '1170', '','0'); -- id=4448
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13336057.66', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4445,0,4446' where returnsellbillid=44;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1470, 1170, 1170, 1170
                    , 1170, 1170, 1170 ,0, 0, 1170, 1170)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1470, returnSellCostBuyPrice = returnSellCostBuyPrice+1170, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1170
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1170, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1170
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1170
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1170
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1170
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1170;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1470, 1170, 1170, 1170
                    , 1170, 1170, 1170 ,0, 0, 1170, 1170)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1470, returnSellCostBuyPrice = returnSellCostBuyPrice+1170, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1170
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1170, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1170
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1170
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1170
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1170
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1170;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1470, -1170, -1170
                    , -1170, -1170, -1170, -1170, -1170, -1170)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1470, netSellCostBuyPrice = netSellCostBuyPrice+-1170
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1170
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1170
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1170
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1170
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1170
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1170
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1170;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cf83833bb and sellbillId = 44 and returnsellbillId = 44
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:44", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:55:44', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18082
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:49", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:55:49', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18083
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:55:50', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18084
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:25:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:55:51", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:55:51', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18085
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:26:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:56:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:56:00', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18086
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:26:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:56:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:56:24', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18087
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:57:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:57:15', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18088
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 ('06ad9cfb868b13', '2026-10-22 11:56:24', '124', '46750.00', '106750', '0', '0', '60000.00',  '60000.00', '0', '60000', '1', '2026-10-22 11:57:15', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=332
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 ('01698', '332', '130', '1698', '75', '800', '60000.00', '0', '', '2026-10-22 11:57:15', '1698','','','0','0','0','0','0',null,'800','60000','0','0','0','0','0','0','0','0','1'); -- id=1785
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:56:24', 1, 1698, 0, 0
                    , 800, 75, 0, 0, 5, '2026-10-22 11:57:15')
                ON DUPLICATE KEY UPDATE buyprice = 800,
                        buyQuantity =buyQuantity+75, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 11:57:15' ; -- id=7111
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1698', '800', '75', '0', 'buyBillController.php', '1785', '', '0', '0'); -- id=1331
UPDATE product SET  productBuyPrice = "800" WHERE productId = 1698 ;
UPDATE buybilldetail SET  quantitybefore = 15 WHERE buybilldetailid = 1785 ;
UPDATE product SET productName = 'جاكيت الاسد', productDescription = '', productCatId = '130', productBuyPrice = '800.00', productSellAllPrice = '850.00', productSellUnitPrice = '850.00', productSellHalfPrice = '850.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01698',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.25' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1698';
UPDATE buybilldetail SET  lastbuyprice = 800 , meanbuyprice = 800, lastbuyprice_withDiscount = 800, meanbuyprice_withDiscount = 800
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where buybilldetailid = 1785;
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 1698;
UPDATE storedetail SET  productquantity = '90', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '75', '0', '332', 'اضافة فاتورة مشتريات', 'buyBillController.php', '15', '90', '5', '2026-10-22 11:56:24','0','0'); -- id=16655
UPDATE supplier SET  suppliercurrentDebt = '106750',suppliercurrentDebtInCurrency= '106750' , userid = '5', supplierdate = '2026-10-22 11:57:15'   WHERE supplierid = '124';
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 ('124', '46750.00', '60000', '0', 'اضافة فاتورة مشتريات', '332', '106750', '2026-10-22 11:56:24', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','60000','1','46750','60000','106750','0',''); -- id=881
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '60000', '60000', '2026-10-22', '5', '0', '0', '2026-10-22 11:57:15','اضافة فاتورة مشتريات رقم 332','1','0',null,'0','332','buyBillController.php?do=details&id=332'); -- id=4447
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4447', '382', '60000', '','0'); -- id=4566
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26693140.54', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4447', '607', '60000', '','0'); -- id=4449
UPDATE accountstree SET name = 'الاسد', customName = 'الاسد', customNameEn = 'الاسد', nameEn = 'الاسد', parent = '81', accountNature = '1', theValue = '106750', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 12:23:57' WHERE id = '607';
update buybill set dailyentryid='4447,0' where buybillid=332;
COMMIT;
UPDATE product SET overAllAveragePrice = 800 WHERE productId = 1698;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:57:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:57:15', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=332'); -- id=18089
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:57:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:57:17', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=332&type=2'); -- id=18090
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:57:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:57:57', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18091
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:58";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:57:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:57:58', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18092
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:57:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 11:57:58', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18093
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:27:58";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 11:57:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 11:57:58', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18094
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:28:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:58:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:58:00', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18095
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:28:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:58:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:58:10', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18096

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cdb17bb5f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 11:58:10', '06ad9cdb17bb5f', '1', '0.00', '0', '0', '1', '30060.00', '30060', '30060', '0', '1', '2026-10-22 11:58:10', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '78' ,'0','','','','','-1','0','0','0','0','0','30060','0','','0','0','30060','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1273
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1273', '0', '2026-10-22 11:58:10', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '30060', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 11:58:10','0','0','',''); -- id=1504
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 6765;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1273', '147', '1886', '15', '320', '4800', '0', '', '0', '2026-10-22 11:58:10', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-15,','1','1','0','0','320','4800','0','','0','0.00','0','0','0','0'); -- id=5106
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5106;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 4800, 4335, 4335
                    , 4335, 4335, 4335, 4335
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 4335, 4335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4335, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4335
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4335
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4800, 4335, 4335
                    , 4335, 4335, 4335, 4335
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4335, 4335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4800, sellCostBuyPrice =sellCostBuyPrice+4335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4335, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4335
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4335
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '85', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '15', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '85', '2', '2026-10-22 11:58:10','0','0'); -- id=16656
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7084;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.8','02412', '1273', '210', '2412', '6', '460', '2760', '0', '', '0', '2026-10-22 11:58:10', '2412', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7084-6,','1','1','0','0','460','2760','0','','0','0.00','0','0','0','0'); -- id=5107
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 427.80
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 5107;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2412, '2026-10-22', 2760, 2760, 2760
                    , 2760, 2566.8, 2566.8, 2566.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2760, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2566.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2566.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2566.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2760, 2760, 2760
                    , 2760, 2566.8, 2566.8, 2566.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2760, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2566.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2566.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2566.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2412', '1', '6', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '69', '2', '2026-10-22 11:58:10','0','0'); -- id=16657
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1273', '166', '2028', '6', '320', '1920', '0', '', '0', '2026-10-22 11:58:10', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=5108
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5108;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 1920, 1920, 1920
                    , 1920, 1785.6, 1785.6, 1781.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1781.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1920, 1920, 1920
                    , 1920, 1785.6, 1785.6, 1781.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1781.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '6', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '120', '2', '2026-10-22 11:58:10','0','0'); -- id=16658
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1273', '147', '1885', '3', '390', '1170', '0', '', '0', '2026-10-22 11:58:10', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=5109
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5109;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 1170, 1077, 1077
                    , 1077, 1077, 1077, 1077
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1077, 1077, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1077
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1077, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1077
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1077, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1077
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1077
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1077
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1077
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1170, 1077, 1077
                    , 1077, 1077, 1077, 1077
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1077, 1077, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1170, sellCostBuyPrice =sellCostBuyPrice+1077
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1077, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1077
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1077, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1077
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1077
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1077
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1077
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '3', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '97', '2', '2026-10-22 11:58:10','0','0'); -- id=16659
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1273', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 11:58:10', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5110
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5110;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '389', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '392', '389', '2', '2026-10-22 11:58:10','0','0'); -- id=16660
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1273', '207', '2380', '12', '450', '5400', '0', '', '0', '2026-10-22 11:58:10', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-12,','1','1','0','0','450','5400','0','','0','0.00','0','0','0','0'); -- id=5111
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5111;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 5400, 5160, 5160
                    , 5160, 5160, 5160, 5160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5160, 5160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5400, 5160, 5160
                    , 5160, 5160, 5160, 5160
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5160, 5160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+5160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5160, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5160
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5160
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '332', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '12', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '344', '332', '2', '2026-10-22 11:58:10','0','0'); -- id=16661
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6537;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('235','01841', '1273', '142', '1841', '6', '250', '1500', '0', '', '0', '2026-10-22 11:58:10', '1841', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6537-6,','1','1','0','0','250','1500','0','','0','0.00','0','0','0','0'); -- id=5112
UPDATE sellbilldetail SET  lastbuyprice = 235.00 , meanbuyprice = 235.00, lastbuyprice_withDiscount = 235.00, meanbuyprice_withDiscount = 235.00
        , lastbuyprice_withTax = 235, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 235
                where sellbilldetailid = 5112;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1841, '2026-10-22', 1500, 1410, 1410
                    , 1410, 1410, 1410, 1410
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1410, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1410
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1410
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1500, 1410, 1410
                    , 1410, 1410, 1410, 1410
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1410, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1410, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1410
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1410
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '163', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '2856';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1841', '1', '6', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '169', '163', '2', '2026-10-22 11:58:10','0','0'); -- id=16662
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 978;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('429','01884', '1273', '147', '1884', '9', '460', '4140', '0', '', '0', '2026-10-22 11:58:10', '1884', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','978-9,','1','1','0','0','460','4140','0','','0','0.00','0','0','0','0'); -- id=5113
UPDATE sellbilldetail SET  lastbuyprice = 429.00 , meanbuyprice = 429.00, lastbuyprice_withDiscount = 429.00, meanbuyprice_withDiscount = 429.00
        , lastbuyprice_withTax = 429, meanbuyprice_withTax = 429, lastbuyprice_withDiscountAndTax = 429
                where sellbilldetailid = 5113;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1884, '2026-10-22', 4140, 3861, 3861
                    , 3861, 3861, 3861, 3861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3861, 3861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4140, sellCostBuyPrice =sellCostBuyPrice+3861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4140, 3861, 3861
                    , 3861, 3861, 3861, 3861
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3861, 3861, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4140, sellCostBuyPrice =sellCostBuyPrice+3861
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3861, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3861
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3861, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3861
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3861
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3861
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3861
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '162', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '2901';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1884', '1', '9', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '171', '162', '2', '2026-10-22 11:58:10','0','0'); -- id=16663
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02390', '1273', '209', '2390', '12', '350', '4200', '0', '', '0', '2026-10-22 11:58:10', '2390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7050-12,','1','1','0','0','350','4200','0','','0','0.00','0','0','0','0'); -- id=5114
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5114;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2390, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4200, 4200, 4200
                    , 4200, 3864, 3864, 3864
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4200, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3864, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3864
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3864
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '105', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '12', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '117', '105', '2', '2026-10-22 11:58:10','0','0'); -- id=16664
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6914;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','02336', '1273', '115', '2336', '6', '460', '2760', '0', '', '0', '2026-10-22 11:58:10', '2336', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6914-6,','1','1','0','0','460','2760','0','','0','0.00','0','0','0','0'); -- id=5115
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 5115;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2336, '2026-10-22', 2760, 2760, 2760
                    , 2760, 2539.2, 2539.2, 2539.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2760, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2539.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2539.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2539.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2760, 2760, 2760
                    , 2760, 2539.2, 2539.2, 2539.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2760, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2539.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2539.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2539.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 11:58:10' WHERE storedetailid = '3730';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2336', '1', '6', '1', '1273', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 11:58:10','0','0'); -- id=16665
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8037283.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8007223.5','30060', '0', '2', 'اضافة فاتورة مبيعات', '1273', '8037283.5', '2026-10-22 11:58:10', '2',  'sellbillController.php','1','','0'); -- id=1578
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30060', '30060', '2026-10-22', '2', '0', '0', '2026-10-22 11:58:10','اضافة فاتورة مبيعات رقم 1273','1','0',null,'0','1273','sellbillController.php?do=showDetail&sellbillid=1273'); -- id=4448
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4448', '419', '30060', '','0'); -- id=4567
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8037283', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4448', '143', '30060', '','0'); -- id=4450
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14447985', 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 ( '27948.6', '27948.6', '2026-10-22', '2', '0', '0', '2026-10-22 11:58:10','اضافة فاتورة مبيعات رقم 1273 - صرف البضاعة من المخزن','1','0',null,'0','1273','sellbillController.php?do=showDetail&sellbillid=1273'); -- id=4449
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4449', '402', '27948.6', '','0'); -- id=4568
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13364006.26', 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 ('4449', '382', '27948.6', '','0'); -- id=4451
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26665191.94', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='4448,0,4449' where sellbillid=1273;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 30060, 28833, 28833
                    , 28833, 27948.6, 27948.6, 27944.76
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,28833, 28803, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30060, sellCostBuyPrice =sellCostBuyPrice+28833
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28833, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28833
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27948.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27948.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27944.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28833
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28803
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 30060, 28833, 28833
                    , 28833, 27948.6, 27948.6, 27944.76
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,28833, 28803, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30060, sellCostBuyPrice =sellCostBuyPrice+28833
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28833, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28833
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27948.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27948.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27944.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28833
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28803
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 30060, 28833, 28833
                    , 28833, 27948.6, 27948.6, 27944.76, 28833, 28803)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+30060, netSellCostBuyPrice = netSellCostBuyPrice+28833
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+28833
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+28833
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+27948.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+27948.6
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+27944.76
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+28833
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+28803;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cdb17bb5f and sellbillId = 1273 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:28:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:58:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:58:10', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18097
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:28:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:58:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:58:34', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=332&type=2'); -- id=18098
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:28:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:58:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:58:36', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18099
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:29:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:59:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:59:44', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18100
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:29:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:59:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 11:59:44', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18101
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:29:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:59:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:59:48', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18102
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('جاكيت 500 الاسد','','130','450','500','0','0','2026-10-22','0','5','0','','0','0','0','0','0','450','450','450','450','450','0','11.11','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2437
UPDATE product SET productName = 'جاكيت 500 الاسد', productDescription = '', productCatId = '130', productBuyPrice = '450', productSellAllPrice = '500', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02437',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2437';
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', '2437', '1.00', '2026-10-22', '5', '0','0243701','500','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2437
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2437', '1', '0', '5', '2026-10-22'); -- id=3832
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2437', '1', '0', '0', '2437', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16666
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2437, 1,'2026-10-22 11:59:48',5)
                ON DUPLICATE KEY UPDATE productid = 2437, edited = 1, sysdate = '2026-10-22 11:59:48', userid = 5; -- id=3619
UPDATE product SET productName = 'جاكيت 500 الاسد', productDescription = '', productCatId = '130', productBuyPrice = '450.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02437',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '11.11' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2437';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:29:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:59:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 11:59:49', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18103
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:29:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 11:59:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 11:59:51', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18104
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:30:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:00:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:00:32', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18105
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 ('06ad9d087e3f80', '2026-10-22 11:59:51', '124', '106750.00', '174250', '0', '0', '67500.00',  '67500.00', '0', '67500', '1', '2026-10-22 12:00:32', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=333
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 ('02437', '333', '130', '2437', '150', '450', '67500.00', '0', '', '2026-10-22 12:00:32', '2437','','','0','0','0','0','0',null,'450','67500','0','0','0','0','0','0','0','0','1'); -- id=1786
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:59:51', 1, 2437, 0, 0
                    , 450, 150, 0, 0, 5, '2026-10-22 12:00:32')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 12:00:32' ; -- id=7112
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2437', '450', '150', '0', 'buyBillController.php', '1786', '', '0', '0'); -- id=1332
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2437 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1786 ;
UPDATE product SET productName = 'جاكيت 500 الاسد', productDescription = '', productCatId = '130', productBuyPrice = '450.00', productSellAllPrice = '500.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02437',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2437';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1786;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2437;
UPDATE storedetail SET  productquantity = '150', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3832';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2437', '1', '150', '0', '333', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '150', '5', '2026-10-22 11:59:51','0','0'); -- id=16667
UPDATE supplier SET  suppliercurrentDebt = '174250',suppliercurrentDebtInCurrency= '174250' , userid = '5', supplierdate = '2026-10-22 12:00:32'   WHERE supplierid = '124';
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 ('124', '106750.00', '67500', '0', 'اضافة فاتورة مشتريات', '333', '174250', '2026-10-22 11:59:51', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','67500','1','106750','67500','174250','0',''); -- id=882
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '67500', '67500', '2026-10-22', '5', '0', '0', '2026-10-22 12:00:32','اضافة فاتورة مشتريات رقم 333','1','0',null,'0','333','buyBillController.php?do=details&id=333'); -- id=4450
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4450', '382', '67500', '','0'); -- id=4569
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26732691.94', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4450', '607', '67500', '','0'); -- id=4452
UPDATE accountstree SET name = 'الاسد', customName = 'الاسد', customNameEn = 'الاسد', nameEn = 'الاسد', parent = '81', accountNature = '1', theValue = '174250', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 12:23:57' WHERE id = '607';
update buybill set dailyentryid='4450,0' where buybillid=333;
COMMIT;
UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2437;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:30:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:00:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:00:32', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=333'); -- id=18106
UPDATE user SET loginip = "" WHERE userid = -1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:30:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:00:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:00:34', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=333&type=2'); -- id=18107
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:34:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:04:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:04:42', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18108

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d08077b91
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 12:04:42', '06ad9d08077b91', '1', '0.00', '0', '0', '1', '1160', '1160', '-1160', '0', '1', '2026-10-22 12:04:42', '', '3', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '3', '0', '', '','','','-1','0','0','0','','0','-1160','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=45
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','45', '0', '2026-10-22 12:04:42', '3', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1160', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:04:42','0','0','',''); -- id=1505
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('450.00', '01585', '45', '115', '1585', '1', '450', '450', '0', '', '0', '0', '1585', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','450','450','0','','0'); -- id=63
UPDATE returnsellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where returnsellbilldetailid = 63;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1585, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 450, 450
                    , 418.5, 418.5, 418.5, 0, 1, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+418.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+418.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+418.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 450, 450
                    , 418.5, 418.5, 418.5, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+418.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+418.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+418.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450;
UPDATE storedetail SET  productquantity = '1', userid = '3', storedetaildate = '2026-10-22 12:04:42' WHERE storedetailid = '1610';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1585', '1', '1', '0', '45', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '1', '3', '2026-10-22 12:04:42','0','0'); -- id=16668
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('450.00', '01637', '45', '122', '1637', '1', '450', '450', '0', '', '0', '0', '1637', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','450','450','0','','0'); -- id=64
UPDATE returnsellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where returnsellbilldetailid = 64;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1637, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 450, 450
                    , 405, 405, 405, 0, 1, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+405
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+405
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+405
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 450, 450, 450, 450
                    , 405, 405, 405, 0, 0, 450, 450)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+450, returnSellCostBuyPrice = returnSellCostBuyPrice+450, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+450
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+450, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+405
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+405
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+405
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+450
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+450;
UPDATE storedetail SET  productquantity = '1', userid = '3', storedetaildate = '2026-10-22 12:04:42' WHERE storedetailid = '1662';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1637', '1', '1', '0', '45', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '1', '3', '2026-10-22 12:04:42','0','0'); -- id=16669
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('250.00', '01376', '45', '71', '1377', '1', '260', '260', '0', '', '0', '0', '1377', '0.00', '0','1','0','','','0','0','0','0','0','0','1','1','','0','0','260','260','0','','0'); -- id=65
UPDATE returnsellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where returnsellbilldetailid = 65;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1377, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 260, 250, 250, 250
                    , 250, 250, 250, 0, 1, 0, 0, 250, 250)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+260, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+250
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+250
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+250
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 260, 250, 250, 250
                    , 250, 250, 250, 0, 0, 250, 250)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+260, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+250
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+250
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+250;
UPDATE storedetail SET  productquantity = '1', userid = '3', storedetaildate = '2026-10-22 12:04:42' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '1', '0', '45', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '1', '3', '2026-10-22 12:04:42','0','0'); -- id=16670
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8036123.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8037283.5','-1160', '1', '2', 'اضافة فاتورة مردوات مبيعات', '45', '8036123.5', '2026-10-22 12:04:42', '3',  'returnsellbillController.php','1','','0'); -- id=1579
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1160', '1160', '2026-10-22', '3', '0', '0', '2026-10-22 12:04:42','اضافة فاتورة مردود مبيعات رقم 45','1','0',null,'0','45','returnsellbillController.php?do=showDetail&returnsellbillid=45'); -- id=4451
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4451', '143', '1160', '','0'); -- id=4570
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14446825', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4451', '419', '1160', '','0'); -- id=4453
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8036123', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1073.5', '1073.5', '2026-10-22', '3', '0', '0', '2026-10-22 12:04:42','اضافة فاتورة مردود مبيعات رقم 45 - صرف البضاعة من المخزن','1','0',null,'0','45','returnsellbillController.php?do=showDetail&returnsellbillid=45'); -- id=4452
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4452', '382', '1073.5', '','0'); -- id=4571
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26733765.44', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4452', '402', '1073.5', '','0'); -- id=4454
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13362932.76', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4451,0,4452' where returnsellbillid=45;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1160, 1150, 1150, 1150
                    , 1073.5, 1073.5, 1073.5 ,0, 0, 1150, 1150)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1160, returnSellCostBuyPrice = returnSellCostBuyPrice+1150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1150
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1150, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1073.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1073.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1073.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1150
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1150;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1160, 1150, 1150, 1150
                    , 1073.5, 1073.5, 1073.5 ,0, 0, 1150, 1150)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1160, returnSellCostBuyPrice = returnSellCostBuyPrice+1150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+1150
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+1150, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+1073.5
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+1073.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+1073.5
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+1150
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+1150;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1160, -1150, -1150
                    , -1150, -1073.5, -1073.5, -1073.5, -1150, -1150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1160, netSellCostBuyPrice = netSellCostBuyPrice+-1150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-1150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-1150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-1073.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-1073.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-1073.5
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-1150
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-1150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d08077b91 and sellbillId = 45 and returnsellbillId = 45
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:34:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:04:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:04:42', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18109
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:03", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:05:03', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18110

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cf97e10fb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cf97e10fb and sellbillId = 1274 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:03", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:05:03', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18111
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:14", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:05:14', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1274'); -- id=18112
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:05:18', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=333&type=2'); -- id=18113
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:05:18', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=333'); -- id=18114
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:05:18', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18115
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:05:21', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18116
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:35:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:05:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:05:21', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18117
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:07', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18118

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cbe8325b4
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cbe8325b4 and sellbillId = 1275 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:08", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:08', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18119
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:06:13', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18120
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:42', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18121
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:42', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18122
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:47', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18123

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9cd34f11b0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:06:47', '06ad9cd34f11b0', '1', '0.00', '0', '0', '1', '11740.00', '11740', '11740', '0', '1', '2026-10-22 12:06:47', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '34' ,'0','','','','','-1','0','0','0','0','0','11740','0','','0','0','11740','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1276
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1276', '0', '2026-10-22 12:06:47', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '11740', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:06:47','0','0','',''); -- id=1508
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','02084', '1276', '43', '2084', '6', '360', '2160', '0', '', '0', '2026-10-22 12:06:47', '2084', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6131-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5120
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 324.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 5120;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2084, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 1944, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1944
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 1944, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1944
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '3', storedetaildate = '2026-10-22 12:06:47' WHERE storedetailid = '3443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2084', '1', '6', '1', '1276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '45', '3', '2026-10-22 12:06:47','0','0'); -- id=16675
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6646;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02243', '1276', '72', '2243', '6', '350', '2100', '0', '', '0', '2026-10-22 12:06:47', '2243', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6646-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5121
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5121;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2243, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '3', storedetaildate = '2026-10-22 12:06:47' WHERE storedetailid = '3634';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2243', '1', '6', '1', '1276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '3', '2026-10-22 12:06:47','0','0'); -- id=16676
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 1170;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01976', '1276', '59', '1976', '6', '320', '1920', '0', '', '0', '2026-10-22 12:06:47', '1976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1170-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=5122
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5122;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 1920, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1920, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '3', storedetaildate = '2026-10-22 12:06:47' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '6', '1', '1276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '42', '3', '2026-10-22 12:06:47','0','0'); -- id=16677
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6759;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('294.4','02274', '1276', '71', '2274', '8', '320', '2560', '0', '', '0', '2026-10-22 12:06:47', '2274', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6759-8,','1','1','0','0','320','2560','0','','0','0.00','0','0','0','0'); -- id=5123
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 294.40, meanbuyprice_withDiscount = 294.40
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 294.4
                where sellbilldetailid = 5123;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2274, '2026-10-22', 2560, 2560, 2560
                    , 2560, 2355.2, 2355.2, 2355.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2560, 2560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2355.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2355.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2355.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2560, 2560, 2560
                    , 2560, 2355.2, 2355.2, 2355.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2560, 2560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2355.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2355.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2355.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '49', userid = '3', storedetaildate = '2026-10-22 12:06:47' WHERE storedetailid = '3667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2274', '1', '8', '1', '1276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '49', '3', '2026-10-22 12:06:47','0','0'); -- id=16678
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7005;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','02371', '1276', '69', '2371', '8', '375', '3000', '0', '', '0', '2026-10-22 12:06:47', '2371', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','7005-8,','1','1','0','0','375','3000','0','','0','0.00','0','0','0','0'); -- id=5124
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 180, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5124;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2371, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-22 12:06:47' WHERE storedetailid = '3765';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2371', '1', '8', '1', '1276', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '12', '3', '2026-10-22 12:06:47','0','0'); -- id=16679
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8047863.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8036123.5','11740', '0', '2', 'اضافة فاتورة مبيعات', '1276', '8047863.5', '2026-10-22 12:06:47', '3',  'sellbillController.php','1','','0'); -- id=1582
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11740', '11740', '2026-10-22', '3', '0', '0', '2026-10-22 12:06:47','اضافة فاتورة مبيعات رقم 1276','1','0',null,'0','1276','sellbillController.php?do=showDetail&sellbillid=1276'); -- id=4457
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4457', '419', '11740', '','0'); -- id=4576
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8047863', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4457', '143', '11740', '','0'); -- id=4459
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14469065', 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 ( '10929.2', '10929.2', '2026-10-22', '3', '0', '0', '2026-10-22 12:06:47','اضافة فاتورة مبيعات رقم 1276 - صرف البضاعة من المخزن','1','0',null,'0','1276','sellbillController.php?do=showDetail&sellbillid=1276'); -- id=4458
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4458', '402', '10929.2', '','0'); -- id=4577
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13383191.96', 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 ('4458', '382', '10929.2', '','0'); -- id=4460
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26715726.24', 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='4457,0,4458' where sellbillid=1276;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 11740, 11560, 11560
                    , 11560, 10929.2, 10929.2, 10929.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11560, 10120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11740, sellCostBuyPrice =sellCostBuyPrice+11560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10929.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10929.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10929.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 11740, 11560, 11560
                    , 11560, 10929.2, 10929.2, 10929.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11560, 10120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11740, sellCostBuyPrice =sellCostBuyPrice+11560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10929.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10929.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10929.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 11740, 11560, 11560
                    , 11560, 10929.2, 10929.2, 10929.2, 11560, 10120)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11740, netSellCostBuyPrice = netSellCostBuyPrice+11560
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+11560
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+11560
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10929.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10929.2
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10929.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+11560
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10120;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9cd34f11b0 and sellbillId = 1276 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:36:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:06:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:06:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18124
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:38:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:08:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:08:05', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18125
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:38:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:08:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:08:09', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=331&type=2'); -- id=18126
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:40:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:10:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:10:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18127
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:40:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:10:41", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:10:41', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18128
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:40:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:10:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:10:45', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18129

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d2278bd9d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:10:45', '06ad9d2278bd9d', '1', '0.00', '0', '0', '1', '7560.00', '7560', '7560', '0', '1', '2026-10-22 12:10:45', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '14' ,'0','','','','','-1','0','0','0','0','0','7560','0','','0','0','7560','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1277
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1277', '0', '2026-10-22 12:10:45', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7560', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:10:45','0','0','',''); -- id=1509
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1277', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 12:10:45', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5125
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5125;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '329', userid = '3', storedetaildate = '2026-10-22 12:10:45' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1277', 'اضافة فاتورة مبيعات', 'sellbillController.php', '332', '329', '3', '2026-10-22 12:10:45','0','0'); -- id=16680
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 5974;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('515','02004', '1277', '162', '2004', '3', '550', '1650', '0', '', '0', '2026-10-22 12:10:45', '2004', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5974-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=5126
UPDATE sellbilldetail SET  lastbuyprice = 515.00 , meanbuyprice = 515.00, lastbuyprice_withDiscount = 515.00, meanbuyprice_withDiscount = 515.00
        , lastbuyprice_withTax = 515, meanbuyprice_withTax = 257.5, lastbuyprice_withDiscountAndTax = 515
                where sellbilldetailid = 5126;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2004, '2026-10-22', 1650, 1545, 1545
                    , 1545, 1545, 1545, 1545
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1545, 772.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1545
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1545, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1545
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1545
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+772.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1650, 1545, 1545
                    , 1545, 1545, 1545, 1545
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1545, 772.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1650, sellCostBuyPrice =sellCostBuyPrice+1545
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1545, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1545
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1545
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+772.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '3', storedetaildate = '2026-10-22 12:10:45' WHERE storedetailid = '3362';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2004', '1', '3', '1', '1277', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '3', '2026-10-22 12:10:45','0','0'); -- id=16681
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','09779', '1277', '5', '659', '5', '600', '3000', '0', '', '0', '2026-10-22 12:10:45', '659', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','600','3000','0','','0','0.00','0','0','0','0'); -- id=5127
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5127;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (659, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2900, 2900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2900, 2900
                    , 2900, 2900, 2900, 2900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2900, 2900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '3', storedetaildate = '2026-10-22 12:10:45' WHERE storedetailid = '659';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('659', '1', '5', '1', '1277', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '10', '3', '2026-10-22 12:10:45','0','0'); -- id=16682
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6909;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('478.4','01959', '1277', '158', '1959', '3', '520', '1560', '0', '', '0', '2026-10-22 12:10:45', '1959', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6909-3,','1','1','0','0','520','1560','0','','0','0.00','0','0','0','0'); -- id=5128
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 528.35, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 476.37
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 528.35
                where sellbilldetailid = 5128;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1959, '2026-10-22', 1560, 1560, 1560
                    , 1585.05, 1560, 1429.11, 1442.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1560, 1585.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1585.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1429.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1442.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1585.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1560, 1560, 1560
                    , 1585.05, 1560, 1429.11, 1442.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1585.05, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1585.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1429.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1442.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1585.05
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '49', userid = '3', storedetaildate = '2026-10-22 12:10:45' WHERE storedetailid = '2976';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1959', '1', '3', '1', '1277', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '49', '3', '2026-10-22 12:10:45','0','0'); -- id=16683
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8055423.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8047863.5','7560', '0', '2', 'اضافة فاتورة مبيعات', '1277', '8055423.5', '2026-10-22 12:10:45', '3',  'sellbillController.php','1','','0'); -- id=1583
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7560', '7560', '2026-10-22', '3', '0', '0', '2026-10-22 12:10:45','اضافة فاتورة مبيعات رقم 1277','1','0',null,'0','1277','sellbillController.php?do=showDetail&sellbillid=1277'); -- id=4459
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4459', '419', '7560', '','0'); -- id=4578
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8055423', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4459', '143', '7560', '','0'); -- id=4461
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14476625', 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 ( '7295', '7295', '2026-10-22', '3', '0', '0', '2026-10-22 12:10:45','اضافة فاتورة مبيعات رقم 1277 - صرف البضاعة من المخزن','1','0',null,'0','1277','sellbillController.php?do=showDetail&sellbillid=1277'); -- id=4460
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4460', '402', '7295', '','0'); -- id=4579
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13390486.96', 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 ('4460', '382', '7295', '','0'); -- id=4462
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26708431.24', 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='4459,0,4460' where sellbillid=1277;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 7560, 7295, 7295
                    , 7320.05, 7295, 7164.11, 7177.52
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7295, 6547.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7560, sellCostBuyPrice =sellCostBuyPrice+7295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7320.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7164.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7177.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6547.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7560, 7295, 7295
                    , 7320.05, 7295, 7164.11, 7177.52
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,7295, 6547.55, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7560, sellCostBuyPrice =sellCostBuyPrice+7295
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7295, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7320.05
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7295, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7164.11
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7177.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7295
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6547.55
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 7560, 7295, 7295
                    , 7320.05, 7295, 7164.11, 7177.52, 7295, 6547.55)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7560, netSellCostBuyPrice = netSellCostBuyPrice+7295
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7295
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7320.05
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7295
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7164.11
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7177.52
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+7295
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6547.55;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d2278bd9d and sellbillId = 1277 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:40:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:10:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:10:45', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18130
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:41:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:11:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:11:39', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18131
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:41:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:11:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:11:41', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18132
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:41:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:11:47", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:11:47', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18133

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9bc0cc9884
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:11:48', '06ad9bc0cc9884', '1', '0.00', '0', '15', '1', '19165.00', '19150', '19150', '0', '1', '2026-10-22 12:11:48', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '41' ,'0','','','','','-1','0','0','0','0','0','19150','0','','0','0','19150','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1278
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1278', '0', '2026-10-22 12:11:48', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '19150', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:11:48','0','0','',''); -- id=1510
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1278', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 12:11:48', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=5129
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5129;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4226.6892773285, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4226.6892773285, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4226.6892773285, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4226.6892773285, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '380', userid = '2', storedetaildate = '2026-10-22 12:11:48' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '389', '380', '2', '2026-10-22 12:11:48','0','0'); -- id=16684
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1278', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 12:11:48', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5130
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5130;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2697.8867727628, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2697.8867727628, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2697.8867727628, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2697.8867727628, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '323', userid = '2', storedetaildate = '2026-10-22 12:11:48' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '329', '323', '2', '2026-10-22 12:11:48','0','0'); -- id=16685
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+17 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1278', '153', '1921', '17', '485', '8245', '0', '', '0', '2026-10-22 12:11:48', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-17,','1','1','0','0','485','8245','0','','0','0.00','0','0','0','0'); -- id=5131
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5131;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 8238.5468301591, 7820, 7820
                    , 7820, 7820, 7820, 7820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 17, 0, 7820, 7820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8238.5468301591, sellCostBuyPrice =sellCostBuyPrice+7820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+17
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8238.5468301591, 7820, 7820
                    , 7820, 7820, 7820, 7820
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7820, 7820, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8238.5468301591, sellCostBuyPrice =sellCostBuyPrice+7820
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7820, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7820
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7820, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7820
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7820
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7820
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7820
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-22 12:11:48' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '17', '1', '1278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '119', '102', '2', '2026-10-22 12:11:48','0','0'); -- id=16686
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1278', '153', '1919', '6', '450', '2700', '0', '', '0', '2026-10-22 12:11:48', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5132
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5132;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 2697.8867727628, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2697.8867727628, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2697.8867727628, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2697.8867727628, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '55', userid = '2', storedetaildate = '2026-10-22 12:11:48' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '6', '1', '1278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '61', '55', '2', '2026-10-22 12:11:48','0','0'); -- id=16687
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02402', '1278', '122', '2402', '3', '430', '1290', '0', '', '0', '2026-10-22 12:11:48', '2402', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7072-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=5133
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5133;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2402, '2026-10-22', 1288.9903469867, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1288.9903469867, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1288.9903469867, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1288.9903469867, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-22 12:11:48' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '3', '1', '1278', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '2', '2026-10-22 12:11:48','0','0'); -- id=16688
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8074573.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8055423.5','19150', '0', '2', 'اضافة فاتورة مبيعات', '1278', '8074573.5', '2026-10-22 12:11:48', '2',  'sellbillController.php','1','','0'); -- id=1584
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19165', '19165', '2026-10-22', '2', '0', '0', '2026-10-22 12:11:48','اضافة فاتورة مبيعات رقم 1278','1','0',null,'0','1278','sellbillController.php?do=showDetail&sellbillid=1278'); -- id=4461
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4461', '419', '19150', '','0'); -- id=4580
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8074573', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4461', '398', '15', '','0'); -- id=4581
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510554.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4461', '143', '19165', '','0'); -- id=4463
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14495790', 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 ( '18161', '18161', '2026-10-22', '2', '0', '0', '2026-10-22 12:11:48','اضافة فاتورة مبيعات رقم 1278 - صرف البضاعة من المخزن','1','0',null,'0','1278','sellbillController.php?do=showDetail&sellbillid=1278'); -- id=4462
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4462', '402', '18161', '','0'); -- id=4582
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13408647.96', 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 ('4462', '382', '18161', '','0'); -- id=4464
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26690270.24', 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='4461,0,4462' where sellbillid=1278;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 19150, 18290, 18290
                    , 18290, 18161, 18161, 18161
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18290, 18290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19150, sellCostBuyPrice =sellCostBuyPrice+18290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 19150, 18290, 18290
                    , 18290, 18161, 18161, 18161
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18290, 18290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19150, sellCostBuyPrice =sellCostBuyPrice+18290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 19150, 18290, 18290
                    , 18290, 18161, 18161, 18161, 18290, 18290)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19150, netSellCostBuyPrice = netSellCostBuyPrice+18290
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18290
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18290
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18161
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18161
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18161
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18290
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18290;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9bc0cc9884 and sellbillId = 1278 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:41:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:11:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:11:48', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18134
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:41:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:11:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:11:54', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18135
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:42:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:12:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:12:02', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18136
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:42:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:12:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:12:24', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18137
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 ('06ad9d36220344', '2026-10-22 12:12:02', '1', '104670.00', '165420', '10', '1', '67500.00',  '60750.00', '', '60750', '1', '2026-10-22 12:12:24', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=334
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 ('01696', '334', '129', '1696', '150', '450', '67500.00', '0', '', '2026-10-22 12:12:24', '1696','','','0','0','0','0','0',null,'450','67500','0','0','0','0','0','0','0','0','1'); -- id=1787
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 12:12:02', 1, 1696, 0, 0
                    , 405, 150, 0, 0, 5, '2026-10-22 12:12:24')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 12:12:24' ; -- id=7113
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1696', '450', '150', '0', 'buyBillController.php', '1787', '', '0', '0'); -- id=1333
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1696 ;
UPDATE buybilldetail SET  quantitybefore = 84 WHERE buybilldetailid = 1787 ;
UPDATE product SET productName = 'شروال الاسد', productDescription = '', productCatId = '129', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01696',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1696';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1787;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1696;
UPDATE storedetail SET  productquantity = '234', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '2708';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '1', '150', '0', '334', 'اضافة فاتورة مشتريات', 'buyBillController.php', '84', '234', '5', '2026-10-22 12:12:02','0','0'); -- id=16689
UPDATE supplier SET  suppliercurrentDebt = '168570',suppliercurrentDebtInCurrency= '165420' , userid = '5', supplierdate = '2026-10-22 12:12:24'   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', '107820.00', '60750', '0', 'اضافة فاتورة مشتريات', '334', '168570', '2026-10-22 12:12:02', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','60750','1','104670','60750','165420','0',''); -- id=883
update buybill set dailyentryid='0,0' where buybillid=334;
COMMIT;
UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1696;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:42:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:12:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:12:24', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=334'); -- id=18138
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:42:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:12:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:12:26', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=334&type=2'); -- id=18139
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:45:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:15:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:15:26', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18140

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9c7f7a508f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9c7f7a508f and sellbillId = 1279 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:45:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:15:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:15:26', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18141
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:16:05', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=334&type=2'); -- id=18142
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:16:10', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18143

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d354578d9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d354578d9 and sellbillId = 1280 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:16:10', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18144
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:16:15', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=334'); -- id=18145
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:16:15', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18146
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:46:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:16:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:16:17', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18147
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:47:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:17:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:17:48', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18148
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:48:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:18:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:18:59', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18149
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:49:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:19:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:19:11', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18150
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:49:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:19:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:19:12', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18151
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:49:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:19:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:19:14', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18152
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:49:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:19:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:19:16', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18153
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:50:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:20:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:20:10', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18154

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d45a6a908
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:20:10', '06ad9d45a6a908', '1', '0.00', '0', '0', '1', '7140.00', '7140', '7140', '0', '1', '2026-10-22 12:20:10', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '18' ,'0','','','','','-1','0','0','0','0','0','7140','0','','0','0','7140','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1281
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1281', '0', '2026-10-22 12:20:10', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '7140', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:20:10','0','0','',''); -- id=1513
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1170;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01976', '1281', '59', '1976', '3', '320', '960', '0', '', '0', '2026-10-22 12:20:10', '1976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1170-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5137
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5137;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 960, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '2', storedetaildate = '2026-10-22 12:20:10' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '3', '1', '1281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '39', '2', '2026-10-22 12:20:10','0','0'); -- id=16693
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6127;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02082', '1281', '43', '2082', '3', '340', '1020', '0', '', '0', '2026-10-22 12:20:10', '2082', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6127-3,','1','1','0','0','340','1020','0','','0','0.00','0','0','0','0'); -- id=5138
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5138;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2082, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1020, 1020, 1020
                    , 1020, 918, 918, 918
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1020, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1020, sellCostBuyPrice =sellCostBuyPrice+1020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+918, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+918
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+918
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 12:20:10' WHERE storedetailid = '3441';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2082', '1', '3', '1', '1281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '2', '2026-10-22 12:20:10','0','0'); -- id=16694
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1281', '147', '2359', '6', '425', '2550', '0', '', '0', '2026-10-22 12:20:10', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-6,','1','1','0','0','425','2550','0','','0','0.00','0','0','0','0'); -- id=5139
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5139;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 2550, 2364, 2364
                    , 2364, 2364, 2364, 2364
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2364, 2364, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2364
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2364, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2364
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2364, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2364
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2364
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2364
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2364
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2364, 2364
                    , 2364, 2364, 2364, 2364
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2364, 2364, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2364
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2364, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2364
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2364, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2364
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2364
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2364
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2364
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '2', storedetaildate = '2026-10-22 12:20:10' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '6', '1', '1281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '45', '2', '2026-10-22 12:20:10','0','0'); -- id=16695
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 902;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','01855', '1281', '144', '1855', '3', '400', '1200', '0', '', '0', '2026-10-22 12:20:10', '1855', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','902-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5140
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 5140;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1855, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1116, 1116, 1116
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1116, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1116
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1116
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '153', userid = '2', storedetaildate = '2026-10-22 12:20:10' WHERE storedetailid = '2872';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1855', '1', '3', '1', '1281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '156', '153', '2', '2026-10-22 12:20:10','0','0'); -- id=16696
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1281', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 12:20:10', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5141
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5141;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '377', userid = '2', storedetaildate = '2026-10-22 12:20:10' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1281', 'اضافة فاتورة مبيعات', 'sellbillController.php', '380', '377', '2', '2026-10-22 12:20:10','0','0'); -- id=16697
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8084923.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8077783.5','7140', '0', '2', 'اضافة فاتورة مبيعات', '1281', '8084923.5', '2026-10-22 12:20:10', '2',  'sellbillController.php','1','','0'); -- id=1587
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '7140', '7140', '2026-10-22', '2', '0', '0', '2026-10-22 12:20:10','اضافة فاتورة مبيعات رقم 1281','1','0',null,'0','1281','sellbillController.php?do=showDetail&sellbillid=1281'); -- id=4467
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4467', '419', '7140', '','0'); -- id=4587
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8084923', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4467', '143', '7140', '','0'); -- id=4469
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14511090', 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 ( '6678', '6678', '2026-10-22', '2', '0', '0', '2026-10-22 12:20:10','اضافة فاتورة مبيعات رقم 1281 - صرف البضاعة من المخزن','1','0',null,'0','1281','sellbillController.php?do=showDetail&sellbillid=1281'); -- id=4468
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4468', '402', '6678', '','0'); -- id=4588
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13422858.96', 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 ('4468', '382', '6678', '','0'); -- id=4470
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26676059.24', 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='4467,0,4468' where sellbillid=1281;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 7140, 6864, 6864
                    , 6864, 6678, 6678, 6678
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6864, 6864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7140, sellCostBuyPrice =sellCostBuyPrice+6864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6678, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6678
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6678
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7140, 6864, 6864
                    , 6864, 6678, 6678, 6678
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6864, 6864, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7140, sellCostBuyPrice =sellCostBuyPrice+6864
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6864, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6864
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6678, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6678
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6678
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6864
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6864
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 7140, 6864, 6864
                    , 6864, 6678, 6678, 6678, 6864, 6864)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+7140, netSellCostBuyPrice = netSellCostBuyPrice+6864
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6864
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6864
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6678
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6678
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6678
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6864
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6864;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d45a6a908 and sellbillId = 1281 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:50:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:20:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:20:10', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18155
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:51:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:21:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:21:00', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18156
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:51:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:21:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:21:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18157
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:51:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:21:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:21:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18158
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:51:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:21:12", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:21:12', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18159

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d3158b57d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:21:12', '06ad9d3158b57d', '1', '0.00', '0', '5', '1', '27795.00', '27790', '27790', '0', '1', '2026-10-22 12:21:12', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '60' ,'0','','','','','-1','0','0','0','0','0','27790','0','','0','0','27790','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1282
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1282', '0', '2026-10-22 12:21:12', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '27790', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:21:12','0','0','',''); -- id=1514
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02402', '1282', '122', '2402', '9', '430', '3870', '0', '', '0', '2026-10-22 12:21:12', '2402', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7072-9,','1','1','0','0','430','3870','0','','0','0.00','0','0','0','0'); -- id=5142
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5142;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2402, '2026-10-22', 3869.3038316244, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3869.3038316244, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3869.3038316244, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3869.3038316244, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '3', storedetaildate = '2026-10-22 12:21:12' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '9', '1', '1282', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '9', '3', '2026-10-22 12:21:12','0','0'); -- id=16698
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1282', '207', '2381', '12', '470', '5640', '0', '', '0', '2026-10-22 12:21:12', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-12,','1','1','0','0','470','5640','0','','0','0.00','0','0','0','0'); -- id=5143
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5143;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 5638.985429034, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5638.985429034, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5638.985429034, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5638.985429034, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '365', userid = '3', storedetaildate = '2026-10-22 12:21:12' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '12', '1', '1282', 'اضافة فاتورة مبيعات', 'sellbillController.php', '377', '365', '3', '2026-10-22 12:21:12','0','0'); -- id=16699
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1282', '153', '1921', '21', '485', '10185', '0', '', '0', '2026-10-22 12:21:12', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-21,','1','1','0','0','485','10185','0','','0','0.00','0','0','0','0'); -- id=5144
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5144;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 10183.167835942, 9660, 9660
                    , 9660, 9660, 9660, 9660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 9660, 9660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10183.167835942, sellCostBuyPrice =sellCostBuyPrice+9660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10183.167835942, 9660, 9660
                    , 9660, 9660, 9660, 9660
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9660, 9660, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10183.167835942, sellCostBuyPrice =sellCostBuyPrice+9660
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9660, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9660
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9660, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9660
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9660
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9660
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9660
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '81', userid = '3', storedetaildate = '2026-10-22 12:21:12' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '21', '1', '1282', 'اضافة فاتورة مبيعات', 'sellbillController.php', '102', '81', '3', '2026-10-22 12:21:12','0','0'); -- id=16700
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1282', '153', '1919', '3', '450', '1350', '0', '', '0', '2026-10-22 12:21:12', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5145
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5145;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 1349.7571505666, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.7571505666, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1349.7571505666, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.7571505666, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '52', userid = '3', storedetaildate = '2026-10-22 12:21:12' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '3', '1', '1282', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '52', '3', '2026-10-22 12:21:12','0','0'); -- id=16701
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1282', '207', '2380', '15', '450', '6750', '0', '', '0', '2026-10-22 12:21:12', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-15,','1','1','0','0','450','6750','0','','0','0.00','0','0','0','0'); -- id=5146
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5146;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 6748.7857528332, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6748.7857528332, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6748.7857528332, 6450, 6450
                    , 6450, 6450, 6450, 6450
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6450, 6450, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6748.7857528332, sellCostBuyPrice =sellCostBuyPrice+6450
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6450, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6450
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6450, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6450
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6450
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6450
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6450
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '308', userid = '3', storedetaildate = '2026-10-22 12:21:12' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '15', '1', '1282', 'اضافة فاتورة مبيعات', 'sellbillController.php', '323', '308', '3', '2026-10-22 12:21:12','0','0'); -- id=16702
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8112713.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8084923.5','27790', '0', '2', 'اضافة فاتورة مبيعات', '1282', '8112713.5', '2026-10-22 12:21:12', '3',  'sellbillController.php','1','','0'); -- id=1588
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '27795', '27795', '2026-10-22', '3', '0', '0', '2026-10-22 12:21:12','اضافة فاتورة مبيعات رقم 1282','1','0',null,'0','1282','sellbillController.php?do=showDetail&sellbillid=1282'); -- id=4469
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4469', '419', '27790', '','0'); -- id=4589
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8112713', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4469', '398', '5', '','0'); -- id=4590
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510559.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4469', '143', '27795', '','0'); -- id=4471
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14538885', 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 ( '26268', '26268', '2026-10-22', '3', '0', '0', '2026-10-22 12:21:12','اضافة فاتورة مبيعات رقم 1282 - صرف البضاعة من المخزن','1','0',null,'0','1282','sellbillController.php?do=showDetail&sellbillid=1282'); -- id=4470
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4470', '402', '26268', '','0'); -- id=4591
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13449126.96', 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 ('4470', '382', '26268', '','0'); -- id=4472
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26649791.24', 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='4469,0,4470' where sellbillid=1282;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 27790, 26655, 26655
                    , 26655, 26268, 26268, 26268
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26655, 26655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27790, sellCostBuyPrice =sellCostBuyPrice+26655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 27790, 26655, 26655
                    , 26655, 26268, 26268, 26268
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,26655, 26655, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27790, sellCostBuyPrice =sellCostBuyPrice+26655
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26655, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26655
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26268, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26268
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26268
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26655
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26655
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 27790, 26655, 26655
                    , 26655, 26268, 26268, 26268, 26655, 26655)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+27790, netSellCostBuyPrice = netSellCostBuyPrice+26655
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+26655
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+26655
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+26268
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+26268
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+26268
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+26655
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+26655;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d3158b57d and sellbillId = 1282 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:51:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:21:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:21:13', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18160
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:54:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:24:03", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:24:03', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18161
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:54:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:24:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:24:04', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1274'); -- id=18162
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:56:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:26:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:26:00', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18163
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:56:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:26:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:26:00', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18164
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:56:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:26:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:26:10', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18165

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d58931766
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:26:10', '06ad9d58931766', '1', '0.00', '0', '0', '1', '10395.00', '10395', '10395', '0', '1', '2026-10-22 12:26:10', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','10395','0','','0','0','10395','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1283
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1283', '0', '2026-10-22 12:26:10', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10395', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:26:10','0','0','',''); -- id=1515
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1283', '147', '1885', '6', '390', '2340', '0', '', '0', '2026-10-22 12:26:10', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5147
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5147;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '88', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '6', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '94', '88', '3', '2026-10-22 12:26:10','0','0'); -- id=16703
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6954;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.75','02340', '1283', '166', '2340', '3', '475', '1425', '0', '', '0', '2026-10-22 12:26:10', '2340', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6954-3,','1','1','0','0','475','1425','0','','0','0.00','0','0','0','0'); -- id=5148
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 441.75, meanbuyprice_withDiscount = 441.75
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 441.75
                where sellbilldetailid = 5148;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2340, '2026-10-22', 1425, 1425, 1425
                    , 1425, 1325.25, 1325.25, 1325.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1425, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1325.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1325.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1325.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1425, 1425, 1425
                    , 1425, 1325.25, 1325.25, 1325.25
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1425, 1425, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1425, sellCostBuyPrice =sellCostBuyPrice+1425
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1425, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1425
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1325.25, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1325.25
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1325.25
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1425
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1425
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '3734';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2340', '1', '3', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '3', '2026-10-22 12:26:10','0','0'); -- id=16704
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 332;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '1283', '103', '1462', '6', '430', '2580', '0', '', '0', '2026-10-22 12:26:10', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=5149
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5149;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-22', 2580, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2580, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '195', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '6', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '201', '195', '3', '2026-10-22 12:26:10','0','0'); -- id=16705
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('413.85','02406', '1283', '210', '2406', '3', '445', '1335', '0', '', '0', '2026-10-22 12:26:10', '2406', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7077-3,','1','1','0','0','445','1335','0','','0','0.00','0','0','0','0'); -- id=5150
UPDATE sellbilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 413.85, meanbuyprice_withDiscount = 413.85
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 413.85
                where sellbilldetailid = 5150;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2406, '2026-10-22', 1335, 1335, 1335
                    , 1335, 1241.55, 1241.55, 1241.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1335, 1335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1335, sellCostBuyPrice =sellCostBuyPrice+1335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1241.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1241.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1241.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1335, 1335, 1335
                    , 1335, 1241.55, 1241.55, 1241.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1335, 1335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1335, sellCostBuyPrice =sellCostBuyPrice+1335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1241.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1241.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1241.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '69', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '3801';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2406', '1', '3', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '69', '3', '2026-10-22 12:26:10','0','0'); -- id=16706
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1283', '147', '2359', '3', '425', '1275', '0', '', '0', '2026-10-22 12:26:10', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-3,','1','1','0','0','425','1275','0','','0','0.00','0','0','0','0'); -- id=5151
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5151;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 1275, 1182, 1182
                    , 1182, 1182, 1182, 1182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1182, 1182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1275, sellCostBuyPrice =sellCostBuyPrice+1182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1275, 1182, 1182
                    , 1182, 1182, 1182, 1182
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1182, 1182, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1275, sellCostBuyPrice =sellCostBuyPrice+1182
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1182, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1182
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1182, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1182
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1182
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1182
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1182
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '3', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '42', '3', '2026-10-22 12:26:10','0','0'); -- id=16707
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6638;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02237', '1283', '103', '2237', '3', '480', '1440', '0', '', '0', '2026-10-22 12:26:10', '2237', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6638-3,','1','1','0','0','480','1440','0','','0','0.00','0','0','0','0'); -- id=5152
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5152;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2237, '2026-10-22', 1440, 1380, 1380
                    , 1380, 1380, 1380, 1380
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1440, 1380, 1380
                    , 1380, 1380, 1380, 1380
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1380, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1380
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '3', storedetaildate = '2026-10-22 12:26:10' WHERE storedetailid = '3628';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2237', '1', '3', '1', '1283', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '36', '3', '2026-10-22 12:26:10','0','0'); -- id=16708
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8123108.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8112713.5','10395', '0', '2', 'اضافة فاتورة مبيعات', '1283', '8123108.5', '2026-10-22 12:26:10', '3',  'sellbillController.php','1','','0'); -- id=1589
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10395', '10395', '2026-10-22', '3', '0', '0', '2026-10-22 12:26:10','اضافة فاتورة مبيعات رقم 1283','1','0',null,'0','1283','sellbillController.php?do=showDetail&sellbillid=1283'); -- id=4471
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4471', '419', '10395', '','0'); -- id=4592
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8123108', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4471', '143', '10395', '','0'); -- id=4473
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14549280', 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 ( '9742.8', '9742.8', '2026-10-22', '3', '0', '0', '2026-10-22 12:26:10','اضافة فاتورة مبيعات رقم 1283 - صرف البضاعة من المخزن','1','0',null,'0','1283','sellbillController.php?do=showDetail&sellbillid=1283'); -- id=4472
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4472', '402', '9742.8', '','0'); -- id=4593
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13458869.76', 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 ('4472', '382', '9742.8', '','0'); -- id=4474
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26640048.44', 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='4471,0,4472' where sellbillid=1283;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10395, 9936, 9936
                    , 9936, 9742.8, 9742.8, 9742.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9936, 9936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9936, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9742.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9742.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9742.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9936
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10395, 9936, 9936
                    , 9936, 9742.8, 9742.8, 9742.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9936, 9936, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9936
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9936, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9936
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9742.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9742.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9742.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9936
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9936
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10395, 9936, 9936
                    , 9936, 9742.8, 9742.8, 9742.8, 9936, 9936)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10395, netSellCostBuyPrice = netSellCostBuyPrice+9936
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9936
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9936
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9742.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9742.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9742.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9936
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9936;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d58931766 and sellbillId = 1283 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:56:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:26:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:26:10', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18166
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:57:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:27:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:27:18', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18167

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d633b024a
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d633b024a and sellbillId = 1284 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 08:57:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:27:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:27:18', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18168
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:00:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:30:40", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:30:40', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18169

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d6f6cf2c1
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d6f6cf2c1 and sellbillId = 1285 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:00:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:30:40", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:30:40', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18170
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:02:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:32:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 12:32:03', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18171
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:02:03";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 12:32:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 12:32:03', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18172
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:02:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:32:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:32:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18173
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:02:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:32:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:32:14', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18174

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d54ab4142
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:32:14', '06ad9d54ab4142', '1', '0.00', '0', '120', '1', '17720.00', '17600', '17600', '0', '1', '2026-10-22 12:32:14', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '39' ,'0','','','','','-1','0','0','0','0','0','17600','0','','0','0','17600','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1286
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1286', '0', '2026-10-22 12:32:14', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17600', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:32:14','0','0','',''); -- id=1518
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1286', '166', '2028', '9', '320', '2880', '0', '', '0', '2026-10-22 12:32:14', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5155
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5155;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 2860.4966139955, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2860.4966139955, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2860.4966139955, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2860.4966139955, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '111', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '9', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '111', '2', '2026-10-22 12:32:14','0','0'); -- id=16711
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7052;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','02392', '1286', '209', '2392', '6', '480', '2880', '0', '', '0', '2026-10-22 12:32:14', '2392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7052-6,','1','1','0','0','480','2880','0','','0','0.00','0','0','0','0'); -- id=5156
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 441.60
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5156;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2392, '2026-10-22', 2860.4966139955, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2860.4966139955, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2860.4966139955, 2880, 2880
                    , 2880, 2649.6, 2649.6, 2649.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2860.4966139955, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2649.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2649.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2649.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '51', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '3787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2392', '1', '6', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '51', '2', '2026-10-22 12:32:14','0','0'); -- id=16712
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7048;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01898', '1286', '149', '1898', '3', '480', '1440', '0', '', '0', '2026-10-22 12:32:14', '1898', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7048-3,','1','1','0','0','480','1440','0','','0','0.00','0','0','0','0'); -- id=5157
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 445.09
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 436.36, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5157;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1898, '2026-10-22', 1430.2483069977, 1440, 1440
                    , 1440, 1324.8, 1335.27, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 1309.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1430.2483069977, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1335.27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1309.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1430.2483069977, 1440, 1440
                    , 1440, 1324.8, 1335.27, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1309.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1430.2483069977, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1335.27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1309.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '2915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1898', '1', '3', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-22 12:32:14','0','0'); -- id=16713
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6167;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('331.2','02104', '1286', '179', '2104', '9', '360', '3240', '0', '', '0', '2026-10-22 12:32:14', '2104', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6167-9,','1','1','0','0','360','3240','0','','0','0.00','0','0','0','0'); -- id=5158
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 331.20, meanbuyprice_withDiscount = 331.20
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 331.2
                where sellbilldetailid = 5158;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2104, '2026-10-22', 3218.0586907449, 3240, 3240
                    , 3240, 2980.8, 2980.8, 2980.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3218.0586907449, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2980.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2980.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2980.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3218.0586907449, 3240, 3240
                    , 3240, 2980.8, 2980.8, 2980.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3218.0586907449, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2980.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2980.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2980.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '3463';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2104', '1', '9', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '99', '90', '2', '2026-10-22 12:32:14','0','0'); -- id=16714
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 1143;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('598','01954', '1286', '158', '1954', '8', '650', '5200', '0', '', '0', '2026-10-22 12:32:14', '1954', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1143-8,','1','1','0','0','650','5200','0','','0','0.00','0','0','0','0'); -- id=5159
UPDATE sellbilldetail SET  lastbuyprice = 650.00 , meanbuyprice = 667.88, lastbuyprice_withDiscount = 598.00, meanbuyprice_withDiscount = 612.29
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 667.88, lastbuyprice_withDiscountAndTax = 598
                where sellbilldetailid = 5159;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1954, '2026-10-22', 5164.7855530474, 5200, 5200
                    , 5343.04, 4784, 4898.32, 4784
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 5200, 5343.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5164.7855530474, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5343.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4784, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4898.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4784
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5343.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5164.7855530474, 5200, 5200
                    , 5343.04, 4784, 4898.32, 4784
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5200, 5343.04, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5164.7855530474, sellCostBuyPrice =sellCostBuyPrice+5200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5343.04
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4784, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4898.32
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4784
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5343.04
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '2971';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1954', '1', '8', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '36', '2', '2026-10-22 12:32:14','0','0'); -- id=16715
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6909;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('478.4','01959', '1286', '158', '1959', '4', '520', '2080', '0', '', '0', '2026-10-22 12:32:14', '1959', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6909-4,','1','1','0','0','520','2080','0','','0','0.00','0','0','0','0'); -- id=5160
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 528.35, lastbuyprice_withDiscount = 520.00, meanbuyprice_withDiscount = 476.37
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 528.35
                where sellbilldetailid = 5160;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1959, '2026-10-22', 2065.914221219, 2080, 2080
                    , 2113.4, 2080, 1905.48, 1923.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2080, 2113.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2065.914221219, sellCostBuyPrice =sellCostBuyPrice+2080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2113.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1905.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1923.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2113.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2065.914221219, 2080, 2080
                    , 2113.4, 2080, 1905.48, 1923.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2080, 2113.4, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2065.914221219, sellCostBuyPrice =sellCostBuyPrice+2080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2113.4
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1905.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1923.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2113.4
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '45', userid = '2', storedetaildate = '2026-10-22 12:32:14' WHERE storedetailid = '2976';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1959', '1', '4', '1', '1286', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '45', '2', '2026-10-22 12:32:14','0','0'); -- id=16716
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8140708.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8123108.5','17600', '0', '2', 'اضافة فاتورة مبيعات', '1286', '8140708.5', '2026-10-22 12:32:14', '2',  'sellbillController.php','1','','0'); -- id=1592
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17720', '17720', '2026-10-22', '2', '0', '0', '2026-10-22 12:32:14','اضافة فاتورة مبيعات رقم 1286','1','0',null,'0','1286','sellbillController.php?do=showDetail&sellbillid=1286'); -- id=4477
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4477', '419', '17600', '','0'); -- id=4598
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8140708', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4477', '398', '120', '','0'); -- id=4599
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510679.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4477', '143', '17720', '','0'); -- id=4479
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14572850', 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 ( '16497.6', '16497.6', '2026-10-22', '2', '0', '0', '2026-10-22 12:32:14','اضافة فاتورة مبيعات رقم 1286 - صرف البضاعة من المخزن','1','0',null,'0','1286','sellbillController.php?do=showDetail&sellbillid=1286'); -- id=4478
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4478', '402', '16497.6', '','0'); -- id=4600
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13480827.36', 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 ('4478', '382', '16497.6', '','0'); -- id=4480
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26618090.84', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='4477,0,4478' where sellbillid=1286;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 17600, 17720, 17720
                    , 17896.44, 16497.6, 16447.87, 16335.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17720, 17765.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17600, sellCostBuyPrice =sellCostBuyPrice+17720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17896.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16497.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16447.87
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16335.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17765.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 17600, 17720, 17720
                    , 17896.44, 16497.6, 16447.87, 16335.2
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17720, 17765.52, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17600, sellCostBuyPrice =sellCostBuyPrice+17720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17896.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16497.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16447.87
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16335.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17765.52
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 17600, 17720, 17720
                    , 17896.44, 16497.6, 16447.87, 16335.2, 17720, 17765.52)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17600, netSellCostBuyPrice = netSellCostBuyPrice+17720
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+17720
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+17896.44
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+16497.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+16447.87
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+16335.2
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+17720
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+17765.52;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d54ab4142 and sellbillId = 1286 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d200121ff
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d200121ff and sellbillId = 1287 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:05:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:35:28", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:35:28', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18177
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:07:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:37:28", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:37:28', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18178
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:07:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:37:28", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:37:28', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18179
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:09:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:39:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:39:46', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18180
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:09:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:39:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:39:47', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18181
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:10:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:40:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:40:24', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18182
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:10:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:40:36", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:40:36', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18183
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:10:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:40:36", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:40:36', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18184
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:07', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18185

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d6b2a9a66
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:41:07', '06ad9d6b2a9a66', '1', '0.00', '0', '200', '1', '29320.00', '29120', '29120', '0', '1', '2026-10-22 12:41:07', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '63' ,'0','','','','','-1','0','0','0','0','0','29120','0','','0','0','29120','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1288
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1288', '0', '2026-10-22 12:41:07', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '29120', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:41:07','0','0','',''); -- id=1520
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+11 where id = 7048;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01898', '1288', '149', '1898', '11', '480', '5280', '0', '', '0', '2026-10-22 12:41:07', '1898', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7048-11,','1','1','0','0','480','5280','0','','0','0.00','0','0','0','0'); -- id=5162
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 445.09
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 436.36, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5162;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1898, '2026-10-22', 5243.9836289222, 5280, 5280
                    , 5280, 4857.6, 4895.99, 4857.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11, 0, 5280, 4799.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5243.9836289222, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4857.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4895.99
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4857.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4799.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+11
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5243.9836289222, 5280, 5280
                    , 5280, 4857.6, 4895.99, 4857.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5280, 4799.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5243.9836289222, sellCostBuyPrice =sellCostBuyPrice+5280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4857.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4895.99
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4857.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4799.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '13', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '2915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1898', '1', '11', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '13', '3', '2026-10-22 12:41:07','0','0'); -- id=16718
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7051;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','02391', '1288', '209', '2391', '9', '440', '3960', '0', '', '0', '2026-10-22 12:41:07', '2391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7051-9,','1','1','0','0','440','3960','0','','0','0.00','0','0','0','0'); -- id=5163
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 5163;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2391, '2026-10-22', 3932.9877216917, 3960, 3960
                    , 3960, 3643.2, 3643.2, 3643.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3932.9877216917, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3643.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3643.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3643.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3932.9877216917, 3960, 3960
                    , 3960, 3643.2, 3643.2, 3643.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3960, 3960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3932.9877216917, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3643.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3643.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3643.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3786';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2391', '1', '9', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '3', '2026-10-22 12:41:07','0','0'); -- id=16719
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7056;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390.6','02395', '1288', '189', '2395', '6', '420', '2520', '0', '', '0', '2026-10-22 12:41:07', '2395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7056-6,','1','1','0','0','420','2520','0','','0','0.00','0','0','0','0'); -- id=5164
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 390.60, meanbuyprice_withDiscount = 390.60
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 390.6
                where sellbilldetailid = 5164;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2395, '2026-10-22', 2502.8103683492, 2520, 2520
                    , 2520, 2343.6, 2343.6, 2343.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2502.8103683492, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2343.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2343.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2343.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2502.8103683492, 2520, 2520
                    , 2520, 2343.6, 2343.6, 2343.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2520, 2520, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2502.8103683492, sellCostBuyPrice =sellCostBuyPrice+2520
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2520, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2520
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2343.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2343.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2343.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2520
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2520
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '6', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '3', '2026-10-22 12:41:07','0','0'); -- id=16720
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 332;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '1288', '103', '1462', '6', '430', '2580', '0', '', '0', '2026-10-22 12:41:07', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=5165
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5165;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-22', 2562.4010914052, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2562.4010914052, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2562.4010914052, 2460, 2460
                    , 2460, 2460, 2460, 2460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2460, 2460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2562.4010914052, sellCostBuyPrice =sellCostBuyPrice+2460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '189', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '6', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '195', '189', '3', '2026-10-22 12:41:07','0','0'); -- id=16721
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 6963;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','02346', '1288', '177', '2346', '7', '550', '3850', '0', '', '0', '2026-10-22 12:41:07', '2346', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6963-7,','1','1','0','0','550','3850','0','','0','0.00','0','0','0','0'); -- id=5166
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 5166;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2346, '2026-10-22', 3823.7380627558, 3570, 3570
                    , 3570, 3570, 3570, 3570
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 3570, 3570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3823.7380627558, sellCostBuyPrice =sellCostBuyPrice+3570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3570
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3570
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3823.7380627558, 3570, 3570
                    , 3570, 3570, 3570, 3570
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3570, 3570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3823.7380627558, sellCostBuyPrice =sellCostBuyPrice+3570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3570
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3570
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '13', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3740';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2346', '1', '7', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '13', '3', '2026-10-22 12:41:07','0','0'); -- id=16722
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('413.85','02406', '1288', '210', '2406', '9', '445', '4005', '0', '', '0', '2026-10-22 12:41:07', '2406', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7077-9,','1','1','0','0','445','4005','0','','0','0.00','0','0','0','0'); -- id=5167
UPDATE sellbilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 413.85, meanbuyprice_withDiscount = 413.85
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 413.85
                where sellbilldetailid = 5167;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2406, '2026-10-22', 3977.6807639836, 4005, 4005
                    , 4005, 3724.65, 3724.65, 3724.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4005, 4005, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3977.6807639836, sellCostBuyPrice =sellCostBuyPrice+4005
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4005, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4005
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3724.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3724.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3724.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4005
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4005
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3977.6807639836, 4005, 4005
                    , 4005, 3724.65, 3724.65, 3724.65
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4005, 4005, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3977.6807639836, sellCostBuyPrice =sellCostBuyPrice+4005
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4005, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4005
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3724.65, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3724.65
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3724.65
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4005
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4005
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3801';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2406', '1', '9', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '69', '60', '3', '2026-10-22 12:41:07','0','0'); -- id=16723
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1288', '147', '2359', '9', '425', '3825', '0', '', '0', '2026-10-22 12:41:07', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-9,','1','1','0','0','425','3825','0','','0','0.00','0','0','0','0'); -- id=5168
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5168;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 3798.9085948158, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3798.9085948158, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3798.9085948158, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3798.9085948158, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '9', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '33', '3', '2026-10-22 12:41:07','0','0'); -- id=16724
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('511.5','02031', '1288', '166', '2031', '6', '550', '3300', '0', '', '0', '2026-10-22 12:41:07', '2031', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6955-6,','1','1','0','0','550','3300','0','','0','0.00','0','0','0','0'); -- id=5169
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 511.50, meanbuyprice_withDiscount = 510.62
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 511.5
                where sellbilldetailid = 5169;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2031, '2026-10-22', 3277.4897680764, 3300, 3300
                    , 3300, 3069, 3063.72, 3060.72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3277.4897680764, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3069, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3063.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3277.4897680764, 3300, 3300
                    , 3300, 3069, 3063.72, 3060.72
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3300, 3300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3277.4897680764, sellCostBuyPrice =sellCostBuyPrice+3300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3069, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3063.72
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '3', storedetaildate = '2026-10-22 12:41:07' WHERE storedetailid = '3390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2031', '1', '6', '1', '1288', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '33', '3', '2026-10-22 12:41:07','0','0'); -- id=16725
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8169828.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8140708.5','29120', '0', '2', 'اضافة فاتورة مبيعات', '1288', '8169828.5', '2026-10-22 12:41:07', '3',  'sellbillController.php','1','','0'); -- id=1594
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '29320', '29320', '2026-10-22', '3', '0', '0', '2026-10-22 12:41:07','اضافة فاتورة مبيعات رقم 1288','1','0',null,'0','1288','sellbillController.php?do=showDetail&sellbillid=1288'); -- id=4481
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4481', '419', '29120', '','0'); -- id=4603
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8169828', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4481', '398', '200', '','0'); -- id=4604
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510879.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4481', '143', '29320', '','0'); -- id=4483
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14607920', 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 ( '27214.05', '27214.05', '2026-10-22', '3', '0', '0', '2026-10-22 12:41:07','اضافة فاتورة مبيعات رقم 1288 - صرف البضاعة من المخزن','1','0',null,'0','1288','sellbillController.php?do=showDetail&sellbillid=1288'); -- id=4482
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4482', '402', '27214.05', '','0'); -- id=4605
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13513541.41', 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 ('4482', '382', '27214.05', '','0'); -- id=4484
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26590876.79', 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='4481,0,4482' where sellbillid=1288;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 29120, 28641, 28641
                    , 28641, 27214.05, 27247.16, 27205.77
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,28641, 28160.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29120, sellCostBuyPrice =sellCostBuyPrice+28641
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28641, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28641
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27214.05, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27247.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27205.77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28641
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28160.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 29120, 28641, 28641
                    , 28641, 27214.05, 27247.16, 27205.77
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,28641, 28160.96, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+29120, sellCostBuyPrice =sellCostBuyPrice+28641
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+28641, sellCostMeanBuyPrice = sellCostMeanBuyPrice+28641
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+27214.05, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+27247.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+27205.77
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+28641
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28160.96
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 29120, 28641, 28641
                    , 28641, 27214.05, 27247.16, 27205.77, 28641, 28160.96)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+29120, netSellCostBuyPrice = netSellCostBuyPrice+28641
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+28641
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+28641
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+27214.05
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+27247.16
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+27205.77
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+28641
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+28160.96;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d6b2a9a66 and sellbillId = 1288 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:07', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18186
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:15", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:15', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1288'); -- id=18187
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:15", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:15', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1288'); -- id=18188
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:20', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18189
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:11:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:41:21", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:41:21', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18190
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:23', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18191
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:24', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18192
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:25', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=332&type=2'); -- id=18193
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:42:25', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=332'); -- id=18194
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 12:42:26', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18195
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:26";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 12:42:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 12:42:26', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18196
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:42:26', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18197
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:27', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18198
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:27', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18199
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:42:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18200
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:42:30', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18201
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:12:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:42:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:42:34', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18202

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d81e86c20
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:42:34', '06ad9d81e86c20', '1', '0.00', '0', '0', '1', '24960.00', '24960', '24960', '0', '1', '2026-10-22 12:42:34', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '69' ,'0','','','','','-1','0','0','0','0','0','24960','0','','0','0','24960','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1289
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1289', '0', '2026-10-22 12:42:34', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '24960', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:42:34','0','0','',''); -- id=1521
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 1167;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6536;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('327.5','01973', '1289', '59', '1973', '12', '340', '4080', '0', '', '0', '2026-10-22 12:42:34', '1973', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1167-9,6536-3,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=5170
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 327.74, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 327.74
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 327.74, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 5170;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1973, '2026-10-22', 4080, 3960, 3960
                    , 3932.88, 3960, 3932.88, 3919.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3960, 3932.88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3932.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3932.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3919.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3932.88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4080, 3960, 3960
                    , 3932.88, 3960, 3932.88, 3919.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3960, 3932.88, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+3960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3932.88
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3932.88
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3919.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3932.88
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '81', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '2990';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1973', '1', '12', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '93', '81', '2', '2026-10-22 12:42:34','0','0'); -- id=16726
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6646;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02243', '1289', '72', '2243', '6', '350', '2100', '0', '', '0', '2026-10-22 12:42:34', '2243', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6646-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5171
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5171;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2243, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '3634';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2243', '1', '6', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '2', '2026-10-22 12:42:34','0','0'); -- id=16727
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6535;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','09499', '1289', '59', '1205', '6', '310', '1860', '0', '', '0', '2026-10-22 12:42:34', '1205', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6535-6,','1','1','0','0','310','1860','0','','0','0.00','0','0','0','0'); -- id=5172
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 299.38, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 299.38
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 299.38, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5172;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1205, '2026-10-22', 1860, 1800, 1800
                    , 1796.28, 1800, 1796.28, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1800, 1796.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1796.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1796.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1796.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1860, 1800, 1800
                    , 1796.28, 1800, 1796.28, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1796.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1860, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1796.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1796.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1796.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1205', '1', '6', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '48', '42', '2', '2026-10-22 12:42:34','0','0'); -- id=16728
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6759;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('294.4','02274', '1289', '71', '2274', '12', '320', '3840', '0', '', '0', '2026-10-22 12:42:34', '2274', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6759-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5173
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 294.40, meanbuyprice_withDiscount = 294.40
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 294.4
                where sellbilldetailid = 5173;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2274, '2026-10-22', 3840, 3840, 3840
                    , 3840, 3532.8, 3532.8, 3532.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3532.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3532.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3532.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3840, 3840
                    , 3840, 3532.8, 3532.8, 3532.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3532.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3532.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3532.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '37', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '3667';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2274', '1', '12', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '37', '2', '2026-10-22 12:42:34','0','0'); -- id=16729
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6737;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('292.5','02262', '1289', '200', '2262', '6', '325', '1950', '0', '', '0', '2026-10-22 12:42:34', '2262', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6737-6,','1','1','0','0','325','1950','0','','0','0.00','0','0','0','0'); -- id=5174
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 292.50, meanbuyprice_withDiscount = 292.50
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 292.5
                where sellbilldetailid = 5174;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2262, '2026-10-22', 1950, 1950, 1950
                    , 1950, 1755, 1755, 1755
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1755, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1755
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1755
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1950, 1950, 1950
                    , 1950, 1755, 1755, 1755
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1755, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1755
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1755
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '29', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '3655';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2262', '1', '6', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '29', '2', '2026-10-22 12:42:34','0','0'); -- id=16730
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6755;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312.8','02271', '1289', '71', '2271', '12', '340', '4080', '0', '', '0', '2026-10-22 12:42:34', '2271', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6755-12,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=5175
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 312.80, meanbuyprice_withDiscount = 312.80
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 312.8
                where sellbilldetailid = 5175;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2271, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '86', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '3664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2271', '1', '12', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '98', '86', '2', '2026-10-22 12:42:34','0','0'); -- id=16731
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7052;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','02392', '1289', '209', '2392', '9', '480', '4320', '0', '', '0', '2026-10-22 12:42:34', '2392', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7052-9,','1','1','0','0','480','4320','0','','0','0.00','0','0','0','0'); -- id=5176
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 441.60
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5176;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2392, '2026-10-22', 4320, 4320, 4320
                    , 4320, 3974.4, 3974.4, 3974.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3974.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3974.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3974.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4320, 4320, 4320
                    , 4320, 3974.4, 3974.4, 3974.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4320, 4320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4320, sellCostBuyPrice =sellCostBuyPrice+4320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3974.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3974.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3974.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '3787';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2392', '1', '9', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '42', '2', '2026-10-22 12:42:34','0','0'); -- id=16732
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7070;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01793', '1289', '138', '1793', '6', '455', '2730', '0', '', '0', '2026-10-22 12:42:34', '1793', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7070-6,','1','1','0','0','455','2730','0','','0','0.00','0','0','0','0'); -- id=5177
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5177;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1793, '2026-10-22', 2730, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2730, 2550, 2550
                    , 2550, 2550, 2550, 2550
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2550, 2550, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2730, sellCostBuyPrice =sellCostBuyPrice+2550
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2550, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2550
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2550, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2550
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2550
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2550
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2550
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '2', storedetaildate = '2026-10-22 12:42:34' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '6', '1', '1289', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '2', '2026-10-22 12:42:34','0','0'); -- id=16733
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8194788.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8169828.5','24960', '0', '2', 'اضافة فاتورة مبيعات', '1289', '8194788.5', '2026-10-22 12:42:34', '2',  'sellbillController.php','1','','0'); -- id=1595
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '24960', '24960', '2026-10-22', '2', '0', '0', '2026-10-22 12:42:34','اضافة فاتورة مبيعات رقم 1289','1','0',null,'0','1289','sellbillController.php?do=showDetail&sellbillid=1289'); -- id=4483
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4483', '419', '24960', '','0'); -- id=4606
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8194788', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4483', '143', '24960', '','0'); -- id=4485
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14632880', 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 ( '23215.8', '23215.8', '2026-10-22', '2', '0', '0', '2026-10-22 12:42:34','اضافة فاتورة مبيعات رقم 1289 - صرف البضاعة من المخزن','1','0',null,'0','1289','sellbillController.php?do=showDetail&sellbillid=1289'); -- id=4484
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4484', '402', '23215.8', '','0'); -- id=4607
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13536757.21', 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 ('4484', '382', '23215.8', '','0'); -- id=4486
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26567660.99', 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='4483,0,4484' where sellbillid=1289;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 24960, 24600, 24600
                    , 24569.16, 23215.8, 23184.96, 23174.88
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24600, 24569.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24960, sellCostBuyPrice =sellCostBuyPrice+24600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24569.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23215.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23184.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23174.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24569.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 24960, 24600, 24600
                    , 24569.16, 23215.8, 23184.96, 23174.88
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24600, 24569.16, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24960, sellCostBuyPrice =sellCostBuyPrice+24600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24569.16
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23215.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23184.96
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23174.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24569.16
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 24960, 24600, 24600
                    , 24569.16, 23215.8, 23184.96, 23174.88, 24600, 24569.16)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+24960, netSellCostBuyPrice = netSellCostBuyPrice+24600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+24600
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+24569.16
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+23215.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+23184.96
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+23174.88
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+24600
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+24569.16;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d81e86c20 and sellbillId = 1289 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9da1498fb9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:43:34', '06ad9da1498fb9', '1', '0.00', '0', '5', '1', '3705.00', '3700', '3700', '0', '1', '2026-10-22 12:43:34', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','3700','0','','0','0','3700','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1290
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1290', '0', '2026-10-22 12:43:34', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3700', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:43:34','0','0','',''); -- id=1522
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7070;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01793', '1290', '138', '1793', '3', '455', '1365', '0', '', '0', '2026-10-22 12:43:34', '1793', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7070-3,','1','1','0','0','455','1365','0','','0','0.00','0','0','0','0'); -- id=5178
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5178;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1793, '2026-10-22', 1363.1578947368, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1363.1578947368, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1363.1578947368, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1363.1578947368, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '3', storedetaildate = '2026-10-22 12:43:34' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '3', '1', '1290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '3', '2026-10-22 12:43:34','0','0'); -- id=16734
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1290', '147', '1885', '6', '390', '2340', '0', '', '0', '2026-10-22 12:43:34', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5179
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5179;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 2336.8421052632, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2336.8421052632, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2336.8421052632, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2336.8421052632, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '82', userid = '3', storedetaildate = '2026-10-22 12:43:34' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '6', '1', '1290', 'اضافة فاتورة مبيعات', 'sellbillController.php', '88', '82', '3', '2026-10-22 12:43:34','0','0'); -- id=16735
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8198488.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8194788.5','3700', '0', '2', 'اضافة فاتورة مبيعات', '1290', '8198488.5', '2026-10-22 12:43:34', '3',  'sellbillController.php','1','','0'); -- id=1596
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3705', '3705', '2026-10-22', '3', '0', '0', '2026-10-22 12:43:34','اضافة فاتورة مبيعات رقم 1290','1','0',null,'0','1290','sellbillController.php?do=showDetail&sellbillid=1290'); -- id=4485
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4485', '419', '3700', '','0'); -- id=4608
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8198488', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4485', '398', '5', '','0'); -- id=4609
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510884.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4485', '143', '3705', '','0'); -- id=4487
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14636585', 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 ( '3429', '3429', '2026-10-22', '3', '0', '0', '2026-10-22 12:43:34','اضافة فاتورة مبيعات رقم 1290 - صرف البضاعة من المخزن','1','0',null,'0','1290','sellbillController.php?do=showDetail&sellbillid=1290'); -- id=4486
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4486', '402', '3429', '','0'); -- id=4610
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13540186.21', 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 ('4486', '382', '3429', '','0'); -- id=4488
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26564231.99', 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='4485,0,4486' where sellbillid=1290;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 3700, 3429, 3429
                    , 3429, 3429, 3429, 3429
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3429, 3429, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3700, sellCostBuyPrice =sellCostBuyPrice+3429
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3429, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3429
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3429, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3429
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3429
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3429
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3429
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3700, 3429, 3429
                    , 3429, 3429, 3429, 3429
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3429, 3429, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3700, sellCostBuyPrice =sellCostBuyPrice+3429
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3429, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3429
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3429, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3429
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3429
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3429
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3429
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 3700, 3429, 3429
                    , 3429, 3429, 3429, 3429, 3429, 3429)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3700, netSellCostBuyPrice = netSellCostBuyPrice+3429
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3429
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3429
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3429
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3429
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3429
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3429
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3429;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9da1498fb9 and sellbillId = 1290 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:13:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:43:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:43:34', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18205
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:16:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:46:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:46:50', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18206
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:16:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:46:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:46:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18207
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:16:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:46:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:46:55', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18208

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9da411fe7b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:46:55', '06ad9da411fe7b', '1', '0.00', '0', '0', '1', '10170.00', '10170', '10170', '0', '1', '2026-10-22 12:46:55', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','10170','0','','0','0','10170','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1291
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1291', '0', '2026-10-22 12:46:55', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10170', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:46:55','0','0','',''); -- id=1523
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6109;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','02069', '1291', '81', '2069', '6', '410', '2460', '0', '', '0', '2026-10-22 12:46:55', '2069', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6109-6,','1','1','0','0','410','2460','0','','0','0.00','0','0','0','0'); -- id=5180
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 5180;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2069, '2026-10-22', 2460, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2460, 2280, 2280
                    , 2280, 2280, 2280, 2280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2280, 2280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '3428';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2069', '1', '6', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '54', '3', '2026-10-22 12:46:55','0','0'); -- id=16736
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6546;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312.8','02234', '1291', '195', '2234', '6', '340', '2040', '0', '', '0', '2026-10-22 12:46:55', '2234', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6546-6,','1','1','0','0','340','2040','0','','0','0.00','0','0','0','0'); -- id=5181
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 312.80, meanbuyprice_withDiscount = 312.80
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 312.8
                where sellbilldetailid = 5181;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2234, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1876.8, 1876.8, 1876.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1876.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1876.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1876.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1876.8, 1876.8, 1876.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1876.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1876.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1876.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '3625';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2234', '1', '6', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '33', '3', '2026-10-22 12:46:55','0','0'); -- id=16737
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6126;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','02081', '1291', '43', '2081', '3', '370', '1110', '0', '', '0', '2026-10-22 12:46:55', '2081', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6126-3,','1','1','0','0','370','1110','0','','0','0.00','0','0','0','0'); -- id=5182
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 5182;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2081, '2026-10-22', 1110, 1110, 1110
                    , 1110, 999, 999, 999
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+999
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+999
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1110, 1110, 1110
                    , 1110, 999, 999, 999
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+999, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+999
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+999
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '3440';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2081', '1', '3', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '3', '2026-10-22 12:46:55','0','0'); -- id=16738
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6101;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','02068', '1291', '81', '2068', '3', '400', '1200', '0', '', '0', '2026-10-22 12:46:55', '2068', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6101-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5183
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5183;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2068, '2026-10-22', 1200, 1110, 1110
                    , 1110, 1110, 1110, 1110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1110, 1110
                    , 1110, 1110, 1110, 1110
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1110, 1110, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1110
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1110, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1110
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1110, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1110
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1110
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1110
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1110
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '255', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '3427';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2068', '1', '3', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '258', '255', '3', '2026-10-22 12:46:55','0','0'); -- id=16739
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6247;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('616.4','02155', '1291', '188', '2155', '3', '670', '2010', '0', '', '0', '2026-10-22 12:46:55', '2155', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6247-3,','1','1','0','0','670','2010','0','','0','0.00','0','0','0','0'); -- id=5184
UPDATE sellbilldetail SET  lastbuyprice = 670.00 , meanbuyprice = 670.00, lastbuyprice_withDiscount = 616.40, meanbuyprice_withDiscount = 616.40
        , lastbuyprice_withTax = 670, meanbuyprice_withTax = 670, lastbuyprice_withDiscountAndTax = 616.4
                where sellbilldetailid = 5184;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2155, '2026-10-22', 2010, 2010, 2010
                    , 2010, 1849.2, 1849.2, 1849.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2010, 2010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+2010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1849.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1849.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1849.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2010, 2010, 2010
                    , 2010, 1849.2, 1849.2, 1849.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2010, 2010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+2010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1849.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1849.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1849.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '3514';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2155', '1', '3', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '39', '3', '2026-10-22 12:46:55','0','0'); -- id=16740
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','i0001919', '1291', '153', '1919', '3', '450', '1350', '0', '', '0', '2026-10-22 12:46:55', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5185
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5185;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 1350, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '49', userid = '3', storedetaildate = '2026-10-22 12:46:55' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '3', '1', '1291', 'اضافة فاتورة مبيعات', 'sellbillController.php', '52', '49', '3', '2026-10-22 12:46:55','0','0'); -- id=16741
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8208658.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8198488.5','10170', '0', '2', 'اضافة فاتورة مبيعات', '1291', '8208658.5', '2026-10-22 12:46:55', '3',  'sellbillController.php','1','','0'); -- id=1597
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10170', '10170', '2026-10-22', '3', '0', '0', '2026-10-22 12:46:55','اضافة فاتورة مبيعات رقم 1291','1','0',null,'0','1291','sellbillController.php?do=showDetail&sellbillid=1291'); -- id=4487
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4487', '419', '10170', '','0'); -- id=4611
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8208658', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4487', '143', '10170', '','0'); -- id=4489
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14646755', 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 ( '9390', '9390', '2026-10-22', '3', '0', '0', '2026-10-22 12:46:55','اضافة فاتورة مبيعات رقم 1291 - صرف البضاعة من المخزن','1','0',null,'0','1291','sellbillController.php?do=showDetail&sellbillid=1291'); -- id=4488
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4488', '402', '9390', '','0'); -- id=4612
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13549576.21', 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 ('4488', '382', '9390', '','0'); -- id=4490
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26554841.99', 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='4487,0,4488' where sellbillid=1291;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10170, 9825, 9825
                    , 9825, 9390, 9390, 9390
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9825, 9825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10170, sellCostBuyPrice =sellCostBuyPrice+9825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10170, 9825, 9825
                    , 9825, 9390, 9390, 9390
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9825, 9825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10170, sellCostBuyPrice =sellCostBuyPrice+9825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9390, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9390
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9390
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10170, 9825, 9825
                    , 9825, 9390, 9390, 9390, 9825, 9825)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10170, netSellCostBuyPrice = netSellCostBuyPrice+9825
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9825
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9825
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9390
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9390
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9390
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9825
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9825;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9da411fe7b and sellbillId = 1291 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:16:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:46:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:46:55', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18209
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:17:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:47:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:47:16', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18210

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d8e0140ff
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:47:16', '06ad9d8e0140ff', '1', '0.00', '0', '0', '1', '3570.00', '3570', '3570', '0', '2', '2026-10-22 12:47:16', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '9' ,'0','','','','','-1','0','0','0','0','0','3570','0','','0','0','3570','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1292
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1292', '0', '2026-10-22 12:47:16', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '3570', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:47:16','0','0','',''); -- id=1524
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 222;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01441', '1292', '88', '1441', '3', '410', '1230', '0', '', '0', '2026-10-22 12:47:16', '1441', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','222-3,','1','1','0','0','410','1230','0','','0','0.00','0','0','0','0'); -- id=5186
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 5186;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1441, '2026-10-22', 1230, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 1230, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '4', storedetaildate = '2026-10-22 12:47:16' WHERE storedetailid = '1472';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1441', '2', '3', '1', '1292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4', '1', '4', '2026-10-22 12:47:16','0','0'); -- id=16742
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '1292', '87', '1325', '6', '390', '2340', '0', '', '0', '2026-10-22 12:47:16', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5187
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 5187;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-22', 2340, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2340, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '160', userid = '4', storedetaildate = '2026-10-22 12:47:16' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '6', '1', '1292', 'اضافة فاتورة مبيعات', 'sellbillController.php', '166', '160', '4', '2026-10-22 12:47:16','0','0'); -- id=16743
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1251322.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1247752.875','3570', '0', '3', 'اضافة فاتورة مبيعات', '1292', '1251322.875', '2026-10-22 12:47:16', '4',  'sellbillController.php','1','','0'); -- id=1598
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3570', '3570', '2026-10-22', '4', '0', '0', '2026-10-22 12:47:16','اضافة فاتورة مبيعات رقم 1292','1','0',null,'0','1292','sellbillController.php?do=showDetail&sellbillid=1292'); -- id=4489
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4489', '501', '3570', '','0'); -- id=4613
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1251322.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4489', '143', '3570', '','0'); -- id=4491
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14650325', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '3240', '3240', '2026-10-22', '4', '0', '0', '2026-10-22 12:47:16','اضافة فاتورة مبيعات رقم 1292 - صرف البضاعة من المخزن','1','0',null,'0','1292','sellbillController.php?do=showDetail&sellbillid=1292'); -- id=4490
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4490', '402', '3240', '','0'); -- id=4614
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13552816.21', 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 ('4490', '492', '3240', '','0'); -- id=4492
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1502196', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4489,0,4490' where sellbillid=1292;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 3570, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3570, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3570, 3240, 3240
                    , 3240, 3240, 3240, 3240
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3240, 3240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3570, sellCostBuyPrice =sellCostBuyPrice+3240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3240, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3240
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3240
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 3570, 3240, 3240
                    , 3240, 3240, 3240, 3240, 3240, 3240)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+3570, netSellCostBuyPrice = netSellCostBuyPrice+3240
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3240
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3240
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3240
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3240
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3240
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3240
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3240;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d8e0140ff and sellbillId = 1292 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:17:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:47:16", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:47:16', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18211
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:17:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:47:27", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:47:27', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1292'); -- id=18212
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:17:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:47:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:47:37', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18213
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:19:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:49:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:49:44', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18214
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:19:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:49:50", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:49:50', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18215

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9d7c1014cb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9d7c1014cb and sellbillId = 1293 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:19:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:49:50", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:49:50', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:19:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:49:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:49:52', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18217
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:19:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:49:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:49:55', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=263'); -- id=18218
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:20:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:50:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:50:06', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18219
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:20:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:50:08", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 12:50:08', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:20:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:50:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:50:20', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18221
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:20:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:50:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:50:48', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18222
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:21:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:51:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:51:44', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18223

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9db8f903e0
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:51:44', '06ad9db8f903e0', '1', '0.00', '0', '5', '1', '12895.00', '12890', '12890', '0', '1', '2026-10-22 12:51:44', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '31' ,'0','','','','','-1','0','0','0','0','0','12890','0','','0','0','12890','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1294
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1294', '0', '2026-10-22 12:51:44', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '12890', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:51:44','0','0','',''); -- id=1526
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1294', '147', '1885', '6', '390', '2340', '0', '', '0', '2026-10-22 12:51:44', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5189
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5189;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 2339.0926715781, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.0926715781, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2339.0926715781, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2339.0926715781, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '76', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '6', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '82', '76', '3', '2026-10-22 12:51:44','0','0'); -- id=16745
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1294', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 12:51:44', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5190
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5190;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1349.4765412951, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.4765412951, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1349.4765412951, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.4765412951, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '305', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '308', '305', '3', '2026-10-22 12:51:44','0','0'); -- id=16746
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','02045', '1294', '42', '2045', '4', '385', '1540', '0', '', '0', '2026-10-22 12:51:44', '2045', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6077-4,','1','1','0','0','385','1540','0','','0','0.00','0','0','0','0'); -- id=5191
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5191;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2045, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3404';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2045', '1', '4', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '16', '3', '2026-10-22 12:51:44','0','0'); -- id=16747
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7056;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390.6','02395', '1294', '189', '2395', '3', '420', '1260', '0', '', '0', '2026-10-22 12:51:44', '2395', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7056-3,','1','1','0','0','420','1260','0','','0','0.00','0','0','0','0'); -- id=5192
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 390.60, meanbuyprice_withDiscount = 390.60
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 390.6
                where sellbilldetailid = 5192;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2395, '2026-10-22', 1259.5114385421, 1260, 1260
                    , 1260, 1171.8, 1171.8, 1171.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1259.5114385421, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1171.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1171.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1171.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1259.5114385421, 1260, 1260
                    , 1260, 1171.8, 1171.8, 1171.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1259.5114385421, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1171.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1171.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1171.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3790';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2395', '1', '3', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '3', '2026-10-22 12:51:44','0','0'); -- id=16748
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6163;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','02103', '1294', '134', '2103', '4', '490', '1960', '0', '', '0', '2026-10-22 12:51:44', '2103', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6163-4,','1','1','0','0','490','1960','0','','0','0.00','0','0','0','0'); -- id=5193
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5193;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2103, '2026-10-22', 1959.2400155099, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1959.2400155099, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1959.2400155099, 1880, 1880
                    , 1880, 1880, 1880, 1880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1880, 1880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1959.2400155099, sellCostBuyPrice =sellCostBuyPrice+1880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3462';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2103', '1', '4', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '8', '3', '2026-10-22 12:51:44','0','0'); -- id=16749
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7070;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01793', '1294', '138', '1793', '3', '455', '1365', '0', '', '0', '2026-10-22 12:51:44', '1793', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7070-3,','1','1','0','0','455','1365','0','','0','0.00','0','0','0','0'); -- id=5194
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5194;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1793, '2026-10-22', 1364.4707250872, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1364.4707250872, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1364.4707250872, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1364.4707250872, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '3', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '15', '3', '2026-10-22 12:51:44','0','0'); -- id=16750
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','02045', '1294', '42', '2045', '4', '385', '1540', '0', '', '0', '2026-10-22 12:51:44', '2045', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6077-4,','1','1','0','0','385','1540','0','','0','0.00','0','0','0','0'); -- id=5195
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5195;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2045, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3404';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2045', '1', '4', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16', '12', '3', '2026-10-22 12:51:44','0','0'); -- id=16751
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','02045', '1294', '42', '2045', '4', '385', '1540', '0', '', '0', '2026-10-22 12:51:44', '2045', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6077-4,','1','1','0','0','385','1540','0','','0','0.00','0','0','0','0'); -- id=5196
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5196;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2045, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1539.4028693292, 1480, 1480
                    , 1480, 1480, 1480, 1480
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1480, 1480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1539.4028693292, sellCostBuyPrice =sellCostBuyPrice+1480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '3', storedetaildate = '2026-10-22 12:51:44' WHERE storedetailid = '3404';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2045', '1', '4', '1', '1294', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '8', '3', '2026-10-22 12:51:44','0','0'); -- id=16752
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8221548.5',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8208658.5','12890', '0', '2', 'اضافة فاتورة مبيعات', '1294', '8221548.5', '2026-10-22 12:51:44', '3',  'sellbillController.php','1','','0'); -- id=1600
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '12895', '12895', '2026-10-22', '3', '0', '0', '2026-10-22 12:51:44','اضافة فاتورة مبيعات رقم 1294','1','0',null,'0','1294','sellbillController.php?do=showDetail&sellbillid=1294'); -- id=4493
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4493', '419', '12890', '','0'); -- id=4617
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8221548', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4493', '398', '5', '','0'); -- id=4618
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510889.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4493', '143', '12895', '','0'); -- id=4495
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14666420', 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 ( '12210.8', '12210.8', '2026-10-22', '3', '0', '0', '2026-10-22 12:51:44','اضافة فاتورة مبيعات رقم 1294 - صرف البضاعة من المخزن','1','0',null,'0','1294','sellbillController.php?do=showDetail&sellbillid=1294'); -- id=4494
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4494', '402', '12210.8', '','0'); -- id=4619
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13568027.01', 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 ('4494', '382', '12210.8', '','0'); -- id=4496
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26539631.19', 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='4493,0,4494' where sellbillid=1294;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 12890, 12299, 12299
                    , 12299, 12210.8, 12210.8, 12210.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12299, 12299, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12890, sellCostBuyPrice =sellCostBuyPrice+12299
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12299, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12299
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12210.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12210.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12210.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12299
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12299
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12890, 12299, 12299
                    , 12299, 12210.8, 12210.8, 12210.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12299, 12299, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12890, sellCostBuyPrice =sellCostBuyPrice+12299
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12299, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12299
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12210.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12210.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12210.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12299
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12299
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 12890, 12299, 12299
                    , 12299, 12210.8, 12210.8, 12210.8, 12299, 12299)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+12890, netSellCostBuyPrice = netSellCostBuyPrice+12299
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12299
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12299
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+12210.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+12210.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+12210.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12299
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12299;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9db8f903e0 and sellbillId = 1294 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:21:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:51:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:51:44', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18224
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:23:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:53:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 12:53:29', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18225
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:23:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:53:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 12:53:29', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18226
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:55:30', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18227
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 12:55:36', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18228
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('ابل سويت شيرت','2026-10-22','ابل سويت شيرت','93', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=213
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (213, 1,'2026-10-22 12:55:36',7)
                ON DUPLICATE KEY UPDATE catid = 213, edited = 1, sysdate = '2026-10-22 12:55:36', userid = 7; -- id=228
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '213', '1', '2026-10-22', '7', '0'); -- id=103
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 12:55:37', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18229
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 12:55:38', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18230
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:55:41', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18231
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 ('06ad9dc787bbbc', '2026-10-22 12:50:48', '195', '51192.00', '74790', '10', '1', '26220.00',  '23598.00', '0', '23598', '1', '2026-10-22 12:55:41', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=335
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 ('02253', '335', '197', '2253', '48', '400', '19200.00', '0', '', '2026-10-22 12:55:41', '2253','','','0','0','0','0','0',null,'400','19200','0','0','0','0','0','0','0','0','1'); -- id=1788
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 12:50:48', 1, 2253, 0, 0
                    , 360, 48, 0, 0, 5, '2026-10-22 12:55:41')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 12:55:41' ; -- id=7114
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2253', '400', '48', '0', 'buyBillController.php', '1788', '', '0', '0'); -- id=1334
UPDATE product SET  productBuyPrice = "400" WHERE productId = 2253 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1788 ;
UPDATE product SET productName = 'روند ارمي النوبي ', productDescription = '', productCatId = '197', productBuyPrice = '400.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-20', conditions = '0', userId = '5', limitamount = '0', parcode = '02253',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '360',meanbuyprice = '400',meanbuyprice_withDiscount = '369.57' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='304.35',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2253';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 369.57
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 304.35, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 1788;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 2253;
UPDATE storedetail SET  productquantity = '48', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3644';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2253', '1', '48', '0', '335', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '48', '5', '2026-10-22 12:50:48','0','0'); -- id=16753
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 ('02254', '335', '197', '2254', '12', '585', '7020.00', '0', '', '2026-10-22 12:55:41', '2254','','','0','0','0','0','0',null,'585','7020','0','0','0','0','0','0','0','0','1'); -- id=1789
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 12:50:48', 1, 2254, 0, 0
                    , 526.5, 12, 0, 0, 5, '2026-10-22 12:55:41')
                ON DUPLICATE KEY UPDATE buyprice = 526.5,
                        buyQuantity =buyQuantity+12, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 12:55:41' ; -- id=7115
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2254', '585', '12', '0', 'buyBillController.php', '1789', '', '0', '0'); -- id=1335
UPDATE product SET  productBuyPrice = "585" WHERE productId = 2254 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1789 ;
UPDATE product SET productName = 'سوسته ارمي النوبي ', productDescription = '', productCatId = '197', productBuyPrice = '585.00', productSellAllPrice = '585.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-20', conditions = '0', userId = '5', limitamount = '0', parcode = '02254',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '585',lastbuyprice_withDiscount = '526.5',meanbuyprice = '585',meanbuyprice_withDiscount = '549.9' , productbuypricereal = '585.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='526.5',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='585',meanbuyprice_withTax='351',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='526.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2254';
UPDATE buybilldetail SET  lastbuyprice = 585 , meanbuyprice = 585, lastbuyprice_withDiscount = 526.5, meanbuyprice_withDiscount = 549.9
        , lastbuyprice_withTax = 585, meanbuyprice_withTax = 351, lastbuyprice_withDiscountAndTax = 526.5
                where buybilldetailid = 1789;
UPDATE productunit SET proUnitBuyPrice  = 585 * productnumber WHERE productid = 2254;
UPDATE storedetail SET  productquantity = '12', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3645';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2254', '1', '12', '0', '335', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '12', '5', '2026-10-22 12:50:48','0','0'); -- id=16754
UPDATE supplier SET  suppliercurrentDebt = '74790',suppliercurrentDebtInCurrency= '74790' , userid = '5', supplierdate = '2026-10-22 12:55:41'   WHERE supplierid = '195';
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 ('195', '51192.00', '23598', '0', 'اضافة فاتورة مشتريات', '335', '74790', '2026-10-22 12:50:48', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','23598','1','51192','23598','74790','0',''); -- id=884
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23598', '23598', '2026-10-22', '5', '0', '0', '2026-10-22 12:55:41','اضافة فاتورة مشتريات رقم 335','1','0',null,'0','335','buyBillController.php?do=details&id=335'); -- id=4495
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4495', '382', '23598', '','0'); -- id=4620
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26563229.19', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4495', '682', '23598', '','0'); -- id=4497
UPDATE accountstree SET name = 'ارمي النوبي', customName = 'ارمي النوبي', customNameEn = 'ارمي النوبي', nameEn = 'ارمي النوبي', parent = '81', accountNature = '1', theValue = '74790', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '5', del = '0', sysdate = '2026-10-20 10:04:33' WHERE id = '682';
update buybill set dailyentryid='4495,0' where buybillid=335;
COMMIT;
UPDATE product SET overAllAveragePrice = 360 WHERE productId = 2253;UPDATE product SET overAllAveragePrice = 526.5 WHERE productId = 2254;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 12:55:41', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=335'); -- id=18232
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:25:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:55:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:55:49', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=335&type=2'); -- id=18233
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:26:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:56:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 12:56:31', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18234
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:26:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:56:35", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:56:35', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18235

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9dd928303f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9dd928303f and sellbillId = 1295 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:26:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:56:35", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:56:35', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18236
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:28:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:58:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 12:58:56', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18237
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:28:56";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 12:58:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 12:58:56', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18238
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:28:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:58:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 12:58:56', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18239
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:28:57";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 12:58:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 12:58:57', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18240
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:28:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:58:58", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:58:58', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18241
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:29:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:59:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:59:03', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18242

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9da8b01d4d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 12:59:03', '06ad9da8b01d4d', '1', '0.00', '0', '10', '1', '26010.00', '26000', '26000', '0', '1', '2026-10-22 12:59:03', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '57' ,'0','','','','','-1','0','0','0','0','0','26000','0','','0','0','26000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1296
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1296', '0', '2026-10-22 12:59:03', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '26000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 12:59:03','0','0','',''); -- id=1528
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1296', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 12:59:03', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5198
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5198;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1349.4809688581, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.4809688581, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1349.4809688581, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1349.4809688581, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '302', userid = '2', storedetaildate = '2026-10-22 12:59:03' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '305', '302', '2', '2026-10-22 12:59:03','0','0'); -- id=16756
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1296', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 12:59:03', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=5199
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5199;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4228.3737024221, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.3737024221, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4228.3737024221, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.3737024221, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '356', userid = '2', storedetaildate = '2026-10-22 12:59:03' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '365', '356', '2', '2026-10-22 12:59:03','0','0'); -- id=16757
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1296', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 12:59:03', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=5200
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5200;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4228.3737024221, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.3737024221, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4228.3737024221, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4228.3737024221, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '347', userid = '2', storedetaildate = '2026-10-22 12:59:03' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '356', '347', '2', '2026-10-22 12:59:03','0','0'); -- id=16758
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1296', '207', '2380', '9', '450', '4050', '0', '', '0', '2026-10-22 12:59:03', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5201
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5201;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 4048.4429065744, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4048.4429065744, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4048.4429065744, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4048.4429065744, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '293', userid = '2', storedetaildate = '2026-10-22 12:59:03' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '9', '1', '1296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '302', '293', '2', '2026-10-22 12:59:03','0','0'); -- id=16759
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+27 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1296', '207', '2380', '27', '450', '12150', '0', '', '0', '2026-10-22 12:59:03', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-27,','1','1','0','0','450','12150','0','','0','0.00','0','0','0','0'); -- id=5202
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5202;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 12145.328719723, 11610, 11610
                    , 11610, 11610, 11610, 11610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 0, 11610, 11610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12145.328719723, sellCostBuyPrice =sellCostBuyPrice+11610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+27
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12145.328719723, 11610, 11610
                    , 11610, 11610, 11610, 11610
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11610, 11610, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12145.328719723, sellCostBuyPrice =sellCostBuyPrice+11610
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11610, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11610
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11610, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11610
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11610
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11610
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11610
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '266', userid = '2', storedetaildate = '2026-10-22 12:59:03' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '27', '1', '1296', 'اضافة فاتورة مبيعات', 'sellbillController.php', '293', '266', '2', '2026-10-22 12:59:03','0','0'); -- id=16760
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8247548.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8221548.5','26000', '0', '2', 'اضافة فاتورة مبيعات', '1296', '8247548.5', '2026-10-22 12:59:03', '2',  'sellbillController.php','1','','0'); -- id=1602
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26010', '26010', '2026-10-22', '2', '0', '0', '2026-10-22 12:59:03','اضافة فاتورة مبيعات رقم 1296','1','0',null,'0','1296','sellbillController.php?do=showDetail&sellbillid=1296'); -- id=4498
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4498', '419', '26000', '','0'); -- id=4623
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8247548', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4498', '398', '10', '','0'); -- id=4624
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '510899.1', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4498', '143', '26010', '','0'); -- id=4500
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14693900', 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 ( '24870', '24870', '2026-10-22', '2', '0', '0', '2026-10-22 12:59:03','اضافة فاتورة مبيعات رقم 1296 - صرف البضاعة من المخزن','1','0',null,'0','1296','sellbillController.php?do=showDetail&sellbillid=1296'); -- id=4499
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4499', '402', '24870', '','0'); -- id=4625
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13594067.01', 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 ('4499', '382', '24870', '','0'); -- id=4501
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26537189.19', 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='4498,0,4499' where sellbillid=1296;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 26000, 24870, 24870
                    , 24870, 24870, 24870, 24870
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24870, 24870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26000, sellCostBuyPrice =sellCostBuyPrice+24870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 26000, 24870, 24870
                    , 24870, 24870, 24870, 24870
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24870, 24870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26000, sellCostBuyPrice =sellCostBuyPrice+24870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+24870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+24870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 26000, 24870, 24870
                    , 24870, 24870, 24870, 24870, 24870, 24870)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+26000, netSellCostBuyPrice = netSellCostBuyPrice+24870
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+24870
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+24870
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+24870
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+24870
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+24870
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+24870
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+24870;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9da8b01d4d and sellbillId = 1296 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:29:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 12:59:03", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 12:59:03', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18243
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:37:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:07:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:07:30', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18244

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ddd371e3e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:07:30', '06ad9ddd371e3e', '1', '0.00', '0', '0', '1', '5525.00', '5525', '5525', '0', '1', '2026-10-22 13:07:30', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '8' ,'0','','','','','-1','0','0','0','0','0','5525','0','','0','0','5525','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1297
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1297', '0', '2026-10-22 13:07:30', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '5525', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:07:30','0','0','',''); -- id=1529
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 228;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01453', '1297', '192', '1453', '3', '850', '2550', '0', '', '0', '2026-10-22 13:07:30', '1453', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','228-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=5203
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        
                where sellbilldetailid = 5203;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1453, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 0, 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '111', userid = '6', storedetaildate = '2026-10-22 13:07:30' WHERE storedetailid = '1478';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1453', '1', '3', '1', '1297', 'اضافة فاتورة مبيعات', 'sellbillController.php', '114', '111', '6', '2026-10-22 13:07:30','0','0'); -- id=16761
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6205;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','02088', '1297', '175', '2088', '5', '595', '2975', '0', '', '0', '2026-10-22 13:07:30', '2088', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6205-5,','1','1','0','0','595','2975','0','','0','0.00','0','0','0','0'); -- id=5204
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5204;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2088, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2975, 2300, 2300
                    , 2300, 2300, 2300, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2975, sellCostBuyPrice =sellCostBuyPrice+2300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '981', userid = '6', storedetaildate = '2026-10-22 13:07:30' WHERE storedetailid = '3447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2088', '1', '5', '1', '1297', 'اضافة فاتورة مبيعات', 'sellbillController.php', '986', '981', '6', '2026-10-22 13:07:30','0','0'); -- id=16762
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1225565',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1220040','5525', '0', '4', 'اضافة فاتورة مبيعات', '1297', '1225565', '2026-10-22 13:07:30', '6',  'sellbillController.php','1','','0'); -- id=1603
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5525', '5525', '2026-10-22', '6', '0', '0', '2026-10-22 13:07:30','اضافة فاتورة مبيعات رقم 1297','1','0',null,'0','1297','sellbillController.php?do=showDetail&sellbillid=1297'); -- id=4500
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4500', '568', '5525', '','0'); -- id=4626
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1225565', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4500', '143', '5525', '','0'); -- id=4502
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14699425', 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 ( '4700', '4700', '2026-10-22', '6', '0', '0', '2026-10-22 13:07:30','اضافة فاتورة مبيعات رقم 1297 - صرف البضاعة من المخزن','1','0',null,'0','1297','sellbillController.php?do=showDetail&sellbillid=1297'); -- id=4501
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4501', '402', '4700', '','0'); -- id=4627
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13598767.01', 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 ('4501', '382', '4700', '','0'); -- id=4503
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26532489.19', 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='4500,0,4501' where sellbillid=1297;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 5525, 4700, 4700
                    , 4700, 4700, 4700, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5525, sellCostBuyPrice =sellCostBuyPrice+4700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5525, 4700, 4700
                    , 4700, 4700, 4700, 2300
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,2300, 2300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5525, sellCostBuyPrice =sellCostBuyPrice+4700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 5525, 4700, 4700
                    , 4700, 4700, 4700, 2300, 2300, 2300)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+5525, netSellCostBuyPrice = netSellCostBuyPrice+4700
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4700
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4700
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4700
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4700
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+2300
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+2300
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+2300;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ddd371e3e and sellbillId = 1297 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:37:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:07:31", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:07:31', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18245
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:38:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:08:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:08:00', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18246
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 002 ابل','','213','580','580','0','0','2026-10-22','0','7','0','','0','0','0','0','0','580','580','580','580','580','0','0','0','0','.','0','0','0','580','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','580','580','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','580','0','0','0','0','0','0','','','0','0','0','0'); -- id=2438
UPDATE product SET productName = 'موديل 002 ابل', productDescription = '', productCatId = '213', productBuyPrice = '580', productSellAllPrice = '580', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02438',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='580',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2438';
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', '2438', '1.00', '2026-10-22', '7', '0','0243801','580','0','0','580','','0','0','0','0','0','0','0','0','0','0'); -- id=2438
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2438', '1', '0', '7', '2026-10-22'); -- id=3833
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2438', '1', '0', '0', '2438', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16763
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2438, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2438, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3620
UPDATE product SET productName = 'موديل 002 ابل', productDescription = '', productCatId = '213', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02438',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='580',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2438';
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 ('موديلات 510 ابل ','','213','510','510','0','0','2026-10-22','0','7','0','','0','0','0','0','0','510','510','510','510','510','0','0','0','0','.','0','0','0','510','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','510','510','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','510','0','0','0','0','0','0','','','0','0','0','0'); -- id=2439
UPDATE product SET productName = 'موديلات 510 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '510', productSellAllPrice = '510', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02439',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='510',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2439';
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', '2439', '1.00', '2026-10-22', '7', '0','0243901','510','0','0','510','','0','0','0','0','0','0','0','0','0','0'); -- id=2439
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2439', '1', '0', '7', '2026-10-22'); -- id=3834
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2439', '1', '0', '0', '2439', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16764
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2439, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2439, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3621
UPDATE product SET productName = 'موديلات 510 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02439',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '510',meanbuyprice = '510',meanbuyprice_withDiscount = '510' , productbuypricereal = '510' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='510',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='510',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='510',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2439';
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 ('موديل 003 ابل ','','213','480','480','0','0','2026-10-22','0','7','0','','0','0','0','0','0','480','480','480','480','480','0','0','0','0','.','0','0','0','480','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','480','480','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','480','0','0','0','0','0','0','','','0','0','0','0'); -- id=2440
UPDATE product SET productName = 'موديل 003 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '480', productSellAllPrice = '480', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02440',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2440';
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', '2440', '1.00', '2026-10-22', '7', '0','0244001','480','0','0','480','','0','0','0','0','0','0','0','0','0','0'); -- id=2440
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2440', '1', '0', '7', '2026-10-22'); -- id=3835
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2440', '1', '0', '0', '2440', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16765
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2440, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2440, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3622
UPDATE product SET productName = 'موديل 003 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02440',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2440';
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 ('موديلات 550 ابل','','213','550','550','0','0','2026-10-22','0','7','0','','0','0','0','0','0','550','550','550','550','550','0','0','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=2441
UPDATE product SET productName = 'موديلات 550 ابل', productDescription = '', productCatId = '213', productBuyPrice = '550', productSellAllPrice = '550', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02441',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2441';
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', '2441', '1.00', '2026-10-22', '7', '0','0244101','550','0','0','550','','0','0','0','0','0','0','0','0','0','0'); -- id=2441
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2441', '1', '0', '7', '2026-10-22'); -- id=3836
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2441', '1', '0', '0', '2441', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16766
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2441, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2441, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3623
UPDATE product SET productName = 'موديلات 550 ابل', productDescription = '', productCatId = '213', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02441',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2441';
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 ('موديل 001 ابل ','','213','450','450','0','0','2026-10-22','0','7','0','','0','0','0','0','0','450','450','450','450','450','0','0','0','0','.','0','0','0','450','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','450','450','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','450','0','0','0','0','0','0','','','0','0','0','0'); -- id=2442
UPDATE product SET productName = 'موديل 001 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02442',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2442';
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', '2442', '1.00', '2026-10-22', '7', '0','0244201','450','0','0','450','','0','0','0','0','0','0','0','0','0','0'); -- id=2442
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2442', '1', '0', '7', '2026-10-22'); -- id=3837
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2442', '1', '0', '0', '2442', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16767
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2442, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2442, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3624
UPDATE product SET productName = 'موديل 001 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02442',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2442';
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 ('موديلات 650 ابل ','','213','650','650','0','0','2026-10-22','0','7','0','','0','0','0','0','0','650','650','650','650','650','0','0','0','0','.','0','0','0','650','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','650','650','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','650','0','0','0','0','0','0','','','0','0','0','0'); -- id=2443
UPDATE product SET productName = 'موديلات 650 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '650', productSellAllPrice = '650', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02443',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='650',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2443';
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', '2443', '1.00', '2026-10-22', '7', '0','0244301','650','0','0','650','','0','0','0','0','0','0','0','0','0','0'); -- id=2443
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2443', '1', '0', '7', '2026-10-22'); -- id=3838
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2443', '1', '0', '0', '2443', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16768
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2443, 1,'2026-10-22 13:08:00',7)
                ON DUPLICATE KEY UPDATE productid = 2443, edited = 1, sysdate = '2026-10-22 13:08:00', userid = 7; -- id=3625
UPDATE product SET productName = 'موديلات 650 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02443',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '650',meanbuyprice = '650',meanbuyprice_withDiscount = '650' , productbuypricereal = '650' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='650',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='650',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='650',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2443';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:38:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:08:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:08:01', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18247
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:38:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:08:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:08:02', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18248
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:38:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:08:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:08:35', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18249
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:38:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:08:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:08:54', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18250
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:13', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18251
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:26', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18252
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:34', '7', 'deleteFinaly', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=deleteFinaly&id=2438&optic=0'); -- id=18253
BEGIN;
UPDATE product SET productName = 'موديل 002 ابل', productDescription = '', productCatId = '213', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '2', userId = '7', limitamount = '0', parcode = '02438',type ='0', expireDate = '0' , dailyentryId = null,isService = '0',isOptic = '0',lastbuyprice = '580.00',lastbuyprice_withDiscount = '580',meanbuyprice = '580.00',meanbuyprice_withDiscount = '580' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='580',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2438';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2438, 2,'2026-10-22 13:09:34',7)
                ON DUPLICATE KEY UPDATE productid = 2438, edited = 2, sysdate = '2026-10-22 13:09:34', userid = 7; -- id=3620
DELETE FROM productingredients WHERE productId = '2438';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:35', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18254
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:36', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18255
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:38', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18256
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:55', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=335&type=2'); -- id=18257
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:09:57', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18258
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:09:58', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18259
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:39:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:09:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:09:59', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18260
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:09", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:09', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18261
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:10', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18262
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:10', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18263
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:12', '5', 'tempdelete', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=tempdelete&id=2439&optic=0'); -- id=18264
BEGIN;
UPDATE product SET conditions =1 WHERE productId =2439;
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2439, 2,'2026-10-22 13:10:12',5)
                ON DUPLICATE KEY UPDATE productid = 2439, edited = 2, sysdate = '2026-10-22 13:10:12', userid = 5; -- id=3621
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:12', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18265
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18266
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:16', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18267
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:26', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18268
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:29', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18269
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:33', '5', 'deleteFinaly', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=deleteFinaly&id=2440&optic=0'); -- id=18270
BEGIN;
UPDATE product SET productName = 'موديل 003 ابل ', productDescription = '', productCatId = '213', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '2', userId = '7', limitamount = '0', parcode = '02440',type ='0', expireDate = '0' , dailyentryId = null,isService = '0',isOptic = '0',lastbuyprice = '480.00',lastbuyprice_withDiscount = '480',meanbuyprice = '480.00',meanbuyprice_withDiscount = '480' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2440';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2440, 2,'2026-10-22 13:10:33',5)
                ON DUPLICATE KEY UPDATE productid = 2440, edited = 2, sysdate = '2026-10-22 13:10:33', userid = 5; -- id=3622
DELETE FROM productingredients WHERE productId = '2440';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:34", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:34', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18271
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:35', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18272
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:37', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18273
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:47', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18274
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:50', '5', 'tempdelete', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=tempdelete&id=2441&optic=0'); -- id=18275
BEGIN;
UPDATE product SET conditions =1 WHERE productId =2441;
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2441, 2,'2026-10-22 13:10:50',5)
                ON DUPLICATE KEY UPDATE productid = 2441, edited = 2, sysdate = '2026-10-22 13:10:50', userid = 5; -- id=3623
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:50', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18276
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:51', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18277
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:40:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:10:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:10:53', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18278
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18279
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:16', '5', 'tempdelete', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=tempdelete&id=2442&optic=0'); -- id=18280
BEGIN;
UPDATE product SET conditions =1 WHERE productId =2442;
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2442, 2,'2026-10-22 13:11:16',5)
                ON DUPLICATE KEY UPDATE productid = 2442, edited = 2, sysdate = '2026-10-22 13:11:16', userid = 5; -- id=3624
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:16', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18281
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:18', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18282
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:19', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18283
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:29', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18284
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:31', '5', 'tempdelete', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=tempdelete&id=2443&optic=0'); -- id=18285
BEGIN;
UPDATE product SET conditions =1 WHERE productId =2443;
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2443, 2,'2026-10-22 13:11:31',5)
                ON DUPLICATE KEY UPDATE productid = 2443, edited = 2, sysdate = '2026-10-22 13:11:31', userid = 5; -- id=3625
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:31', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=sucess'); -- id=18286
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:41:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:11:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:11:32', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18287
UPDATE product SET productName = 'HDS/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '580.00', productSellHalfPrice = '580.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01812',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580.00',lastbuyprice_withDiscount = '522',meanbuyprice = '580.00',meanbuyprice_withDiscount = '551' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='522',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='290',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='522',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1812';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1812, 1,'2026-10-22 13:12:20',7)
                ON DUPLICATE KEY UPDATE productid = 1812, edited = 1, sysdate = '2026-10-22 13:12:20', userid = 7; -- id=2732
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510.00',lastbuyprice_withDiscount = '459',meanbuyprice = '510.00',meanbuyprice_withDiscount = '488.14' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='459',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='218.57',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1813, 1,'2026-10-22 13:12:31',7)
                ON DUPLICATE KEY UPDATE productid = 1813, edited = 1, sysdate = '2026-10-22 13:12:31', userid = 7; -- id=2733
UPDATE product SET productName = 'RA/W27/005', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01814',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510.00',lastbuyprice_withDiscount = '459',meanbuyprice = '510.00',meanbuyprice_withDiscount = '484.5' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='459',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='255',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1814';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1814, 1,'2026-10-22 13:12:37',7)
                ON DUPLICATE KEY UPDATE productid = 1814, edited = 1, sysdate = '2026-10-22 13:12:37', userid = 7; -- id=2734
UPDATE product SET productName = 'RA/W27/004', productDescription = '', productCatId = '140', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450.00',lastbuyprice_withDiscount = '405',meanbuyprice = '450.00',meanbuyprice_withDiscount = '427.5' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='225',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1815, 1,'2026-10-22 13:12:51',7)
                ON DUPLICATE KEY UPDATE productid = 1815, edited = 1, sysdate = '2026-10-22 13:12:51', userid = 7; -- id=2735
UPDATE product SET productName = 'HDF/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650.00',lastbuyprice_withDiscount = '585',meanbuyprice = '650.00',meanbuyprice_withDiscount = '617.5' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='325',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1818, 1,'2026-10-22 13:13:24',7)
                ON DUPLICATE KEY UPDATE productid = 1818, edited = 1, sysdate = '2026-10-22 13:13:24', userid = 7; -- id=2738
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:43:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:13:28", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:13:28', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18288

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e06313bdf
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e06313bdf and sellbillId = 1298 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:43:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:13:28", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:13:28', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18289
UPDATE product SET productName = 'موديلات 550 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550.00',lastbuyprice_withDiscount = '495',meanbuyprice = '550.00',meanbuyprice_withDiscount = '522.5' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='275',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1822, 1,'2026-10-22 13:13:49',7)
                ON DUPLICATE KEY UPDATE productid = 1822, edited = 1, sysdate = '2026-10-22 13:13:49', userid = 7; -- id=2742
UPDATE product SET productName = 'RA/W27/011', productDescription = '', productCatId = '140', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450.00',lastbuyprice_withDiscount = '405',meanbuyprice = '450.00',meanbuyprice_withDiscount = '427.5' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='225',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1815, 1,'2026-10-22 13:13:53',7)
                ON DUPLICATE KEY UPDATE productid = 1815, edited = 1, sysdate = '2026-10-22 13:13:53', userid = 7; -- id=2735
UPDATE product SET productName = 'HDF/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650.00',lastbuyprice_withDiscount = '585',meanbuyprice = '650.00',meanbuyprice_withDiscount = '617.5' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='325',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1818, 1,'2026-10-22 13:13:55',7)
                ON DUPLICATE KEY UPDATE productid = 1818, edited = 1, sysdate = '2026-10-22 13:13:55', userid = 7; -- id=2738
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 13:14:14', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18290
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:14";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 13:14:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 13:14:14', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18291
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:16', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18292
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:20", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:20', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18293

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9de680ed7b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:14:20', '06ad9de680ed7b', '1', '0.00', '0', '0', '1', '85650.00', '85650', '85650', '0', '1', '2026-10-22 13:14:20', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '183' ,'0','','','','','-1','0','0','0','0','0','85650','0','','0','0','85650','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1299
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1299', '0', '2026-10-22 13:14:20', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '85650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:14:20','0','0','',''); -- id=1531
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+57 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1299', '153', '1921', '57', '485', '27645', '0', '', '0', '2026-10-22 13:14:20', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-57,','1','1','0','0','485','27645','0','','0','0.00','0','0','0','0'); -- id=5207
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5207;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 57, 0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27645, sellCostBuyPrice =sellCostBuyPrice+26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+57
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27645, sellCostBuyPrice =sellCostBuyPrice+26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '57', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '81', '24', '2', '2026-10-22 13:14:20','0','0'); -- id=16771
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7026;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','02379', '1299', '153', '2379', '21', '495', '10395', '0', '', '0', '2026-10-22 13:14:20', '2379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7026-21,','1','1','0','0','495','10395','0','','0','0.00','0','0','0','0'); -- id=5208
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5208;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2379, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '3773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2379', '1', '21', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '24', '2', '2026-10-22 13:14:20','0','0'); -- id=16772
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1299', '153', '1919', '21', '450', '9450', '0', '', '0', '2026-10-22 13:14:20', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-21,','1','1','0','0','450','9450','0','','0','0.00','0','0','0','0'); -- id=5209
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5209;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '21', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '28', '2', '2026-10-22 13:14:20','0','0'); -- id=16773
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+48 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1299', '207', '2380', '48', '450', '21600', '0', '', '0', '2026-10-22 13:14:20', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-48,','1','1','0','0','450','21600','0','','0','0.00','0','0','0','0'); -- id=5210
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5210;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 48, 0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21600, sellCostBuyPrice =sellCostBuyPrice+20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+48
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21600, sellCostBuyPrice =sellCostBuyPrice+20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '218', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '48', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '266', '218', '2', '2026-10-22 13:14:20','0','0'); -- id=16774
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+27 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1299', '207', '2381', '27', '470', '12690', '0', '', '0', '2026-10-22 13:14:20', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-27,','1','1','0','0','470','12690','0','','0','0.00','0','0','0','0'); -- id=5211
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5211;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12690, sellCostBuyPrice =sellCostBuyPrice+12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+27
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12690, sellCostBuyPrice =sellCostBuyPrice+12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '320', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '27', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '347', '320', '2', '2026-10-22 13:14:20','0','0'); -- id=16775
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02402', '1299', '122', '2402', '9', '430', '3870', '0', '', '0', '2026-10-22 13:14:20', '2402', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7072-9,','1','1','0','0','430','3870','0','','0','0.00','0','0','0','0'); -- id=5212
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5212;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2402, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 13:14:20' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '9', '1', '1299', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '0', '2', '2026-10-22 13:14:20','0','0'); -- id=16776
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8333198.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8247548.5','85650', '0', '2', 'اضافة فاتورة مبيعات', '1299', '8333198.5', '2026-10-22 13:14:20', '2',  'sellbillController.php','1','','0'); -- id=1605
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '85650', '85650', '2026-10-22', '2', '0', '0', '2026-10-22 13:14:20','اضافة فاتورة مبيعات رقم 1299','1','0',null,'0','1299','sellbillController.php?do=showDetail&sellbillid=1299'); -- id=4504
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4504', '419', '85650', '','0'); -- id=4630
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8333198', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4504', '143', '85650', '','0'); -- id=4506
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14789020', 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 ( '81288', '81288', '2026-10-22', '2', '0', '0', '2026-10-22 13:14:20','اضافة فاتورة مبيعات رقم 1299 - صرف البضاعة من المخزن','1','0',null,'0','1299','sellbillController.php?do=showDetail&sellbillid=1299'); -- id=4505
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4505', '402', '81288', '','0'); -- id=4631
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13683805.01', 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 ('4505', '382', '81288', '','0'); -- id=4507
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26447451.19', 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='4504,0,4505' where sellbillid=1299;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85650, sellCostBuyPrice =sellCostBuyPrice+81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85650, sellCostBuyPrice =sellCostBuyPrice+81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288, 81675, 81675)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+85650, netSellCostBuyPrice = netSellCostBuyPrice+81675
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+81675
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+81675
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+81288
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+81288
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+81288
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+81675
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+81675;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9de680ed7b and sellbillId = 1299 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:21", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:21', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18294
UPDATE product SET productName = 'موديلات 650 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650.00',lastbuyprice_withDiscount = '585',meanbuyprice = '650.00',meanbuyprice_withDiscount = '617.5' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='325',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1818, 1,'2026-10-22 13:14:34',7)
                ON DUPLICATE KEY UPDATE productid = 1818, edited = 1, sysdate = '2026-10-22 13:14:34', userid = 7; -- id=2738
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18295
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:40', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18296
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:46', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18297

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9dcb08bd47
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:14:46', '06ad9dcb08bd47', '1', '0.00', '0', '1', '2', '46680.00', '46213.2', '46213.2', '0', '1', '2026-10-22 13:14:46', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '102' ,'0','','','','','-1','0','0','0','0','0','46213','0','','0','0','46213.2','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1300
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1300', '0', '2026-10-22 13:14:46', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '46213.2', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:14:46','0','0','',''); -- id=1532
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1300', '207', '2380', '9', '450', '4050', '0', '', '0', '2026-10-22 13:14:46', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5213
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5213;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 4009.5, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4009.5, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4009.5, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4009.5, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '209', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '9', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '218', '209', '3', '2026-10-22 13:14:46','0','0'); -- id=16777
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1300', '147', '1885', '9', '390', '3510', '0', '', '0', '2026-10-22 13:14:46', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=5214
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5214;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 3474.9, 3231, 3231
                    , 3231, 3231, 3231, 3231
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3231, 3231, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3474.9, sellCostBuyPrice =sellCostBuyPrice+3231
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3231, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3231
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3231, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3231
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3231
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3231
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3231
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3474.9, 3231, 3231
                    , 3231, 3231, 3231, 3231
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3231, 3231, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3474.9, sellCostBuyPrice =sellCostBuyPrice+3231
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3231, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3231
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3231, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3231
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3231
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3231
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3231
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '67', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '9', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '76', '67', '3', '2026-10-22 13:14:46','0','0'); -- id=16778
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 983;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('319','01889', '1300', '147', '1889', '6', '350', '2100', '0', '', '0', '2026-10-22 13:14:46', '1889', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','983-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5215
UPDATE sellbilldetail SET  lastbuyprice = 319.00 , meanbuyprice = 319.00, lastbuyprice_withDiscount = 319.00, meanbuyprice_withDiscount = 319.00
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where sellbilldetailid = 5215;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1889, '2026-10-22', 2079, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2079, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2079, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2079, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '6', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '120', '3', '2026-10-22 13:14:46','0','0'); -- id=16779
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 983;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('319','01889', '1300', '147', '1889', '3', '350', '1050', '0', '', '0', '2026-10-22 13:14:46', '1889', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','983-3,','1','1','0','0','350','1050','0','','0','0.00','0','0','0','0'); -- id=5216
UPDATE sellbilldetail SET  lastbuyprice = 319.00 , meanbuyprice = 319.00, lastbuyprice_withDiscount = 319.00, meanbuyprice_withDiscount = 319.00
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where sellbilldetailid = 5216;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1889, '2026-10-22', 1039.5, 957, 957
                    , 957, 957, 957, 957
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 957, 957, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1039.5, sellCostBuyPrice =sellCostBuyPrice+957
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+957, sellCostMeanBuyPrice = sellCostMeanBuyPrice+957
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+957, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+957
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+957
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+957
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+957
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1039.5, 957, 957
                    , 957, 957, 957, 957
                    , 0, 0, 0, 0
                    , 0, 0, 0, 957, 957, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1039.5, sellCostBuyPrice =sellCostBuyPrice+957
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+957, sellCostMeanBuyPrice = sellCostMeanBuyPrice+957
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+957, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+957
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+957
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+957
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+957
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '117', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '120', '117', '3', '2026-10-22 13:14:46','0','0'); -- id=16780
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 983;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('319','01889', '1300', '147', '1889', '6', '350', '2100', '0', '', '0', '2026-10-22 13:14:46', '1889', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','983-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5217
UPDATE sellbilldetail SET  lastbuyprice = 319.00 , meanbuyprice = 319.00, lastbuyprice_withDiscount = 319.00, meanbuyprice_withDiscount = 319.00
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where sellbilldetailid = 5217;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1889, '2026-10-22', 2079, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2079, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2079, 1914, 1914
                    , 1914, 1914, 1914, 1914
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1914, 1914, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2079, sellCostBuyPrice =sellCostBuyPrice+1914
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1914, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1914
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1914, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1914
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1914
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1914
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1914
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '111', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '6', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '117', '111', '3', '2026-10-22 13:14:46','0','0'); -- id=16781
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7084;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('427.8','02412', '1300', '210', '2412', '6', '460', '2760', '0', '', '0', '2026-10-22 13:14:46', '2412', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7084-6,','1','1','0','0','460','2760','0','','0','0.00','0','0','0','0'); -- id=5218
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 427.80, meanbuyprice_withDiscount = 427.80
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 427.8
                where sellbilldetailid = 5218;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2412, '2026-10-22', 2732.4, 2760, 2760
                    , 2760, 2566.8, 2566.8, 2566.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2732.4, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2566.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2566.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2566.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2732.4, 2760, 2760
                    , 2760, 2566.8, 2566.8, 2566.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2732.4, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2566.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2566.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2566.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3807';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2412', '1', '6', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '69', '63', '3', '2026-10-22 13:14:46','0','0'); -- id=16782
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('511.5','02031', '1300', '166', '2031', '3', '550', '1650', '0', '', '0', '2026-10-22 13:14:46', '2031', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6955-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=5219
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 511.50, meanbuyprice_withDiscount = 510.62
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 511.5
                where sellbilldetailid = 5219;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2031, '2026-10-22', 1633.5, 1650, 1650
                    , 1650, 1534.5, 1531.86, 1530.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1633.5, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1534.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1531.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1633.5, 1650, 1650
                    , 1650, 1534.5, 1531.86, 1530.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1633.5, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1534.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1531.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2031', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '3', '2026-10-22 13:14:46','0','0'); -- id=16783
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1300', '207', '2380', '8', '450', '3600', '0', '', '0', '2026-10-22 13:14:46', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-8,','1','1','0','0','450','3600','0','','0','0.00','0','0','0','0'); -- id=5220
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5220;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 3564, 3440, 3440
                    , 3440, 3440, 3440, 3440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3440, 3440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3564, sellCostBuyPrice =sellCostBuyPrice+3440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3564, 3440, 3440
                    , 3440, 3440, 3440, 3440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3440, 3440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3564, sellCostBuyPrice =sellCostBuyPrice+3440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '201', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '8', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '209', '201', '3', '2026-10-22 13:14:46','0','0'); -- id=16784
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6256;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','02164', '1300', '189', '2164', '6', '400', '2400', '0', '', '0', '2026-10-22 13:14:46', '2164', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6256-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=5221
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 5221;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2164, '2026-10-22', 2376, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2376, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2376, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2376, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3523';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2164', '1', '6', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '6', '3', '2026-10-22 13:14:46','0','0'); -- id=16785
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6794;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('358.8','02290', '1300', '179', '2290', '3', '390', '1170', '0', '', '0', '2026-10-22 13:14:46', '2290', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6794-3,','1','1','0','0','390','1170','0','','0','0.00','0','0','0','0'); -- id=5222
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 358.80, meanbuyprice_withDiscount = 358.80
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 358.8
                where sellbilldetailid = 5222;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2290, '2026-10-22', 1158.3, 1170, 1170
                    , 1170, 1076.4, 1076.4, 1076.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1158.3, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1076.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1076.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1076.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1158.3, 1170, 1170
                    , 1170, 1076.4, 1076.4, 1076.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1170, 1170, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1158.3, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1076.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1076.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1076.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1170
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1170
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2290', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '3', '2026-10-22 13:14:46','0','0'); -- id=16786
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 6681;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','02248', '1300', '196', '2248', '4', '550', '2200', '0', '', '0', '2026-10-22 13:14:46', '2248', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6681-4,','1','1','0','0','550','2200','0','','0','0.00','0','0','0','0'); -- id=5223
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 522.50
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 5223;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2248, '2026-10-22', 2178, 2200, 2200
                    , 2200, 1980, 2090, 1980
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2200, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2178, sellCostBuyPrice =sellCostBuyPrice+2200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2090
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1980
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2178, 2200, 2200
                    , 2200, 1980, 2090, 1980
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2200, 1100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2178, sellCostBuyPrice =sellCostBuyPrice+2200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2090
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1980
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '14', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3639';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2248', '1', '4', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '14', '3', '2026-10-22 13:14:46','0','0'); -- id=16787
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1300', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 13:14:46', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5224
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5224;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1395.9, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395.9, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1395.9, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395.9, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '317', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '320', '317', '3', '2026-10-22 13:14:46','0','0'); -- id=16788
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('511.5','02031', '1300', '166', '2031', '3', '550', '1650', '0', '', '0', '2026-10-22 13:14:46', '2031', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6955-3,','1','1','0','0','550','1650','0','','0','0.00','0','0','0','0'); -- id=5225
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 511.50, meanbuyprice_withDiscount = 510.62
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 511.5
                where sellbilldetailid = 5225;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2031, '2026-10-22', 1633.5, 1650, 1650
                    , 1650, 1534.5, 1531.86, 1530.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1633.5, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1534.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1531.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1633.5, 1650, 1650
                    , 1650, 1534.5, 1531.86, 1530.36
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1633.5, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1534.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1531.86
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1530.36
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3390';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2031', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '3', '2026-10-22 13:14:46','0','0'); -- id=16789
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6681;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','02248', '1300', '196', '2248', '8', '550', '4400', '0', '', '0', '2026-10-22 13:14:46', '2248', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6681-8,','1','1','0','0','550','4400','0','','0','0.00','0','0','0','0'); -- id=5226
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 522.50
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 5226;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2248, '2026-10-22', 4356, 4400, 4400
                    , 4400, 3960, 4180, 3960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4400, 2200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4356, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4356, 4400, 4400
                    , 4400, 3960, 4180, 3960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4400, 2200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4356, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3639';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2248', '1', '8', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14', '6', '3', '2026-10-22 13:14:46','0','0'); -- id=16790
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6301;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('505','02184', '1300', '190', '2184', '8', '530', '4240', '0', '', '0', '2026-10-22 13:14:46', '2184', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6301-8,','1','1','0','0','530','4240','0','','0','0.00','0','0','0','0'); -- id=5227
UPDATE sellbilldetail SET  lastbuyprice = 505.00 , meanbuyprice = 505.00, lastbuyprice_withDiscount = 505.00, meanbuyprice_withDiscount = 505.00
        , lastbuyprice_withTax = 505, meanbuyprice_withTax = 252.5, lastbuyprice_withDiscountAndTax = 505
                where sellbilldetailid = 5227;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2184, '2026-10-22', 4197.6, 4040, 4040
                    , 4040, 4040, 4040, 4040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4040, 2020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4197.6, sellCostBuyPrice =sellCostBuyPrice+4040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4197.6, 4040, 4040
                    , 4040, 4040, 4040, 4040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4040, 2020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4197.6, sellCostBuyPrice =sellCostBuyPrice+4040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3544';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2184', '1', '8', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '16', '3', '2026-10-22 13:14:46','0','0'); -- id=16791
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7036;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('477','02384', '1300', '95', '2384', '6', '530', '3180', '0', '', '0', '2026-10-22 13:14:46', '2384', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7036-6,','1','1','0','0','530','3180','0','','0','0.00','0','0','0','0'); -- id=5228
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 477.00, meanbuyprice_withDiscount = 477.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 477
                where sellbilldetailid = 5228;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2384, '2026-10-22', 3148.2, 3180, 3180
                    , 3180, 2862, 2862, 2862
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3180, 3180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3148.2, sellCostBuyPrice =sellCostBuyPrice+3180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2862, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2862
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2862
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3148.2, 3180, 3180
                    , 3180, 2862, 2862, 2862
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3180, 3180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3148.2, sellCostBuyPrice =sellCostBuyPrice+3180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2862, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2862
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2862
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '3778';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2384', '1', '6', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '21', '3', '2026-10-22 13:14:46','0','0'); -- id=16792
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 774;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','01653', '1300', '123', '1653', '3', '350', '1050', '0', '', '0', '2026-10-22 13:14:46', '1653', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','774-3,','1','1','0','0','350','1050','0','','0','0.00','0','0','0','0'); -- id=5229
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 332.50
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5229;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1653, '2026-10-22', 1039.5, 1050, 1050
                    , 1050, 945, 997.5, 945
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1039.5, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+997.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+945
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1039.5, 1050, 1050
                    , 1050, 945, 997.5, 945
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 525, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1039.5, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+945, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+997.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+945
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+525
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '1678';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1653', '1', '3', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '3', '2026-10-22 13:14:46','0','0'); -- id=16793
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 1136;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('500','01948', '1300', '157', '1948', '8', '520', '4160', '0', '', '0', '2026-10-22 13:14:46', '1948', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1136-8,','1','1','0','0','520','4160','0','','0','0.00','0','0','0','0'); -- id=5230
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 500.00, meanbuyprice_withDiscount = 500.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 500
                where sellbilldetailid = 5230;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1948, '2026-10-22', 4118.4, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4118.4, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4118.4, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4118.4, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '85', userid = '3', storedetaildate = '2026-10-22 13:14:46' WHERE storedetailid = '2965';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1948', '1', '8', '1', '1300', 'اضافة فاتورة مبيعات', 'sellbillController.php', '93', '85', '3', '2026-10-22 13:14:46','0','0'); -- id=16794
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8379411.7',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8333198.5','46213.2', '0', '2', 'اضافة فاتورة مبيعات', '1300', '8379411.7', '2026-10-22 13:14:46', '3',  'sellbillController.php','1','','0'); -- id=1606
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '46680', '46680', '2026-10-22', '3', '0', '0', '2026-10-22 13:14:46','اضافة فاتورة مبيعات رقم 1300','1','0',null,'0','1300','sellbillController.php?do=showDetail&sellbillid=1300'); -- id=4506
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4506', '419', '46213.2', '','0'); -- id=4632
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8379411.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4506', '398', '466.8', '','0'); -- id=4633
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '511365.9', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4506', '143', '46680', '','0'); -- id=4508
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14835700', 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 ( '43407.2', '43407.2', '2026-10-22', '3', '0', '0', '2026-10-22 13:14:46','اضافة فاتورة مبيعات رقم 1300 - صرف البضاعة من المخزن','1','0',null,'0','1300','sellbillController.php?do=showDetail&sellbillid=1300'); -- id=4507
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4507', '402', '43407.2', '','0'); -- id=4634
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13727212.21', 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 ('4507', '382', '43407.2', '','0'); -- id=4509
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26404043.99', 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='4506,0,4507' where sellbillid=1300;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 46213.2, 45176, 45176
                    , 45176, 43407.2, 43784.42, 43398.92
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,45176, 39331, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46213.2, sellCostBuyPrice =sellCostBuyPrice+45176
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45176, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45176
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43407.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43784.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43398.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45176
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39331
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 46213.2, 45176, 45176
                    , 45176, 43407.2, 43784.42, 43398.92
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,45176, 39331, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+46213.2, sellCostBuyPrice =sellCostBuyPrice+45176
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+45176, sellCostMeanBuyPrice = sellCostMeanBuyPrice+45176
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+43407.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+43784.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+43398.92
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+45176
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39331
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 46213.2, 45176, 45176
                    , 45176, 43407.2, 43784.42, 43398.92, 45176, 39331)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+46213.2, netSellCostBuyPrice = netSellCostBuyPrice+45176
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+45176
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+45176
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+43407.2
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+43784.42
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+43398.92
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+45176
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+39331;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9dcb08bd47 and sellbillId = 1300 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:14:46', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18298
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:14:47', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18299
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:44:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:14:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:14:47', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18300
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:45:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:15:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:15:06', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18301
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 480 دبل اس','','140','480','480','0','0','2026-10-22','0','7','0','','0','0','0','0','0','480','480','480','480','480','0','0','0','0','.','0','0','0','480','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','480','480','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','480','0','0','0','0','0','0','','','0','0','0','0'); -- id=2444
UPDATE product SET productName = 'موديل 480 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '480', productSellAllPrice = '480', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02444',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2444';
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', '2444', '1.00', '2026-10-22', '7', '0','0244401','480','0','0','480','','0','0','0','0','0','0','0','0','0','0'); -- id=2444
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2444', '1', '0', '7', '2026-10-22'); -- id=3839
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2444', '1', '0', '0', '2444', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16795
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2444, 1,'2026-10-22 13:15:06',7)
                ON DUPLICATE KEY UPDATE productid = 2444, edited = 1, sysdate = '2026-10-22 13:15:06', userid = 7; -- id=3641
UPDATE product SET productName = 'موديل 480 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02444',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '480',meanbuyprice = '480',meanbuyprice_withDiscount = '480' , productbuypricereal = '480' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='480',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2444';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:45:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:15:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:15:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18302
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:45:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:15:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:15:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18303
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:48:08";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:49:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:19:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:19:46', '2', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1299'); -- id=18304
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:50:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:20:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:20:12', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18305
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:51:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:21:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:21:04', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18306

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e35c750bb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e35c750bb and sellbillId = 1301 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:51:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:21:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:21:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18307
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:51:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:21:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:21:49', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18308
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 ('06ad9e22ba2060', '2026-10-22 13:15:07', '136', '100608.00', '292956', '10', '1', '213720.00',  '192348.00', '0', '192348', '1', '2026-10-22 13:21:49', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=336
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01812', '336', '140', '1812', '24', '580', '13920.00', '0', '', '2026-10-22 13:21:49', '1812','','','0','0','0','0','0',null,'580','13920','0','0','0','0','0','0','0','0','1'); -- id=1790
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1812, 0, 0
                    , 522, 24, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 522,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7116
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1812', '580', '24', '0', 'buyBillController.php', '1790', '', '0', '0'); -- id=1336
UPDATE product SET  productBuyPrice = "580" WHERE productId = 1812 ;
UPDATE buybilldetail SET  quantitybefore = 24 WHERE buybilldetailid = 1790 ;
UPDATE product SET productName = 'HDS/W27/002', productDescription = '', productCatId = '140', productBuyPrice = '580.00', productSellAllPrice = '580.00', productSellUnitPrice = '580.00', productSellHalfPrice = '580.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01812',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '522',meanbuyprice = '580',meanbuyprice_withDiscount = '536.5' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='522',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='435',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='522',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1812';
UPDATE buybilldetail SET  lastbuyprice = 580 , meanbuyprice = 580, lastbuyprice_withDiscount = 522, meanbuyprice_withDiscount = 536.5
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 522
                where buybilldetailid = 1790;
UPDATE productunit SET proUnitBuyPrice  = 580 * productnumber WHERE productid = 1812;
UPDATE storedetail SET  productquantity = '48', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2826';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1812', '1', '24', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '24', '48', '7', '2026-10-22 13:15:07','0','0'); -- id=16797
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01813', '336', '140', '1813', '36', '510', '18360.00', '0', '', '2026-10-22 13:21:49', '1813','','','0','0','0','0','0',null,'510','18360','0','0','0','0','0','0','0','0','1'); -- id=1791
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1813, 0, 0
                    , 459, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7117
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1813', '510', '36', '0', 'buyBillController.php', '1791', '', '0', '0'); -- id=1337
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1813 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 1791 ;
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '466.29' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='459',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='437.14',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 466.29
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 437.14, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 1791;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1813;
UPDATE storedetail SET  productquantity = '48', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2827';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1813', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '48', '7', '2026-10-22 13:15:07','0','0'); -- id=16798
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 ('02444', '336', '140', '2444', '36', '480', '17280.00', '0', '', '2026-10-22 13:21:49', '2444','','','0','0','0','0','0',null,'480','17280','0','0','0','0','0','0','0','0','1'); -- id=1792
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 2444, 0, 0
                    , 432, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 432,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7118
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2444', '480', '36', '0', 'buyBillController.php', '1792', '', '0', '0'); -- id=1338
UPDATE product SET  productBuyPrice = "480" WHERE productId = 2444 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1792 ;
UPDATE product SET productName = 'موديل 480 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '480.00', productSellAllPrice = '480.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02444',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '480',lastbuyprice_withDiscount = '432',meanbuyprice = '480',meanbuyprice_withDiscount = '432' , productbuypricereal = '480.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='480',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='480',meanbuyprice_withTax='480',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='432',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2444';
UPDATE buybilldetail SET  lastbuyprice = 480 , meanbuyprice = 480, lastbuyprice_withDiscount = 432, meanbuyprice_withDiscount = 432
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 480, lastbuyprice_withDiscountAndTax = 432
                where buybilldetailid = 1792;
UPDATE productunit SET proUnitBuyPrice  = 480 * productnumber WHERE productid = 2444;
UPDATE storedetail SET  productquantity = '36', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3839';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2444', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '7', '2026-10-22 13:15:07','0','0'); -- id=16799
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01818', '336', '140', '1818', '36', '650', '23400.00', '0', '', '2026-10-22 13:21:49', '1818','','','0','0','0','0','0',null,'650','23400','0','0','0','0','0','0','0','0','1'); -- id=1793
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1818, 0, 0
                    , 585, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7119
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1818', '650', '36', '0', 'buyBillController.php', '1793', '', '0', '0'); -- id=1339
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1818 ;
UPDATE buybilldetail SET  quantitybefore = 4 WHERE buybilldetailid = 1793 ;
UPDATE product SET productName = 'موديلات 650 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '588.25' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='617.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 588.25
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 617.5, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 1793;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1818;
UPDATE storedetail SET  productquantity = '40', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2832';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1818', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '4', '40', '7', '2026-10-22 13:15:07','0','0'); -- id=16800
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01822', '336', '140', '1822', '36', '550', '19800.00', '0', '', '2026-10-22 13:21:49', '1822','','','0','0','0','0','0',null,'550','19800','0','0','0','0','0','0','0','0','1'); -- id=1794
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1822, 0, 0
                    , 495, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7120
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1822', '550', '36', '0', 'buyBillController.php', '1794', '', '0', '0'); -- id=1340
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1822 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1794 ;
UPDATE product SET productName = 'موديلات 550 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '495',meanbuyprice = '550',meanbuyprice_withDiscount = '495' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 1794;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1822;
UPDATE storedetail SET  productquantity = '36', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2836';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1822', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '7', '2026-10-22 13:15:07','0','0'); -- id=16801
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01822', '336', '140', '1822', '36', '550', '19800.00', '0', '', '2026-10-22 13:21:49', '1822','','','0','0','0','0','0',null,'550','19800','0','0','0','0','0','0','0','0','1'); -- id=1795
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1822, 0, 0
                    , 495, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7120
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1822', '550', '36', '0', 'buyBillController.php', '1795', '', '0', '0'); -- id=1341
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1822 ;
UPDATE buybilldetail SET  quantitybefore = 36 WHERE buybilldetailid = 1795 ;
UPDATE product SET productName = 'موديلات 550 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '495',meanbuyprice = '550',meanbuyprice_withDiscount = '495' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 1795;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1822;
UPDATE storedetail SET  productquantity = '72', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2836';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1822', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '36', '72', '7', '2026-10-22 13:15:07','0','0'); -- id=16802
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01815', '336', '140', '1815', '36', '450', '16200.00', '0', '', '2026-10-22 13:21:49', '1815','','','0','0','0','0','0',null,'450','16200','0','0','0','0','0','0','0','0','1'); -- id=1796
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1815, 0, 0
                    , 405, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7122
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1815', '450', '36', '0', 'buyBillController.php', '1796', '', '0', '0'); -- id=1342
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1815 ;
UPDATE buybilldetail SET  quantitybefore = 24 WHERE buybilldetailid = 1796 ;
UPDATE product SET productName = 'RA/W27/011', productDescription = '', productCatId = '140', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01815',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '414' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1815';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 414
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1796;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1815;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2829';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1815', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '24', '60', '7', '2026-10-22 13:15:07','0','0'); -- id=16803
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01818', '336', '140', '1818', '36', '650', '23400.00', '0', '', '2026-10-22 13:21:49', '1818','','','0','0','0','0','0',null,'650','23400','0','0','0','0','0','0','0','0','1'); -- id=1797
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1818, 0, 0
                    , 585, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7119
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1818', '650', '36', '0', 'buyBillController.php', '1797', '', '0', '0'); -- id=1343
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1818 ;
UPDATE buybilldetail SET  quantitybefore = 40 WHERE buybilldetailid = 1797 ;
UPDATE product SET productName = 'موديلات 650 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585.33' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='646.75',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585.33
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 646.75, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 1797;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1818;
UPDATE storedetail SET  productquantity = '76', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2832';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1818', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '40', '76', '7', '2026-10-22 13:15:07','0','0'); -- id=16804
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01813', '336', '140', '1813', '36', '510', '18360.00', '0', '', '2026-10-22 13:21:49', '1813','','','0','0','0','0','0',null,'510','18360','0','0','0','0','0','0','0','0','1'); -- id=1798
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1813, 0, 0
                    , 459, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 459,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7117
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1813', '510', '36', '0', 'buyBillController.php', '1798', '', '0', '0'); -- id=1344
UPDATE product SET  productBuyPrice = "510" WHERE productId = 1813 ;
UPDATE buybilldetail SET  quantitybefore = 48 WHERE buybilldetailid = 1798 ;
UPDATE product SET productName = 'RA/W27/009', productDescription = '', productCatId = '140', productBuyPrice = '510.00', productSellAllPrice = '510.00', productSellUnitPrice = '510.00', productSellHalfPrice = '510.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01813',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '510',lastbuyprice_withDiscount = '459',meanbuyprice = '510',meanbuyprice_withDiscount = '460.82' , productbuypricereal = '510.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='459',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='510',meanbuyprice_withTax='491.79',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='459',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1813';
UPDATE buybilldetail SET  lastbuyprice = 510 , meanbuyprice = 510, lastbuyprice_withDiscount = 459, meanbuyprice_withDiscount = 460.82
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 491.79, lastbuyprice_withDiscountAndTax = 459
                where buybilldetailid = 1798;
UPDATE productunit SET proUnitBuyPrice  = 510 * productnumber WHERE productid = 1813;
UPDATE storedetail SET  productquantity = '84', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2827';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1813', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '48', '84', '7', '2026-10-22 13:15:07','0','0'); -- id=16805
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01822', '336', '140', '1822', '36', '550', '19800.00', '0', '', '2026-10-22 13:21:49', '1822','','','0','0','0','0','0',null,'550','19800','0','0','0','0','0','0','0','0','1'); -- id=1799
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1822, 0, 0
                    , 495, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7120
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1822', '550', '36', '0', 'buyBillController.php', '1799', '', '0', '0'); -- id=1345
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1822 ;
UPDATE buybilldetail SET  quantitybefore = 72 WHERE buybilldetailid = 1799 ;
UPDATE product SET productName = 'موديلات 550 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '550.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01822',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '495',meanbuyprice = '550',meanbuyprice_withDiscount = '495' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1822';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 1799;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1822;
UPDATE storedetail SET  productquantity = '108', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2836';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1822', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '72', '108', '7', '2026-10-22 13:15:07','0','0'); -- id=16806
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01818', '336', '140', '1818', '36', '650', '23400.00', '0', '', '2026-10-22 13:21:49', '1818','','','0','0','0','0','0',null,'650','23400','0','0','0','0','0','0','0','0','1'); -- id=1800
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:15:07', 1, 1818, 0, 0
                    , 585, 36, 0, 0, 7, '2026-10-22 13:21:49')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 13:21:49' ; -- id=7119
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1818', '650', '36', '0', 'buyBillController.php', '1800', '', '0', '0'); -- id=1346
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1818 ;
UPDATE buybilldetail SET  quantitybefore = 76 WHERE buybilldetailid = 1800 ;
UPDATE product SET productName = 'موديلات 650 دبل اس', productDescription = '', productCatId = '140', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-09', conditions = '0', userId = '1', limitamount = '0', parcode = '01818',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585.03' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='649.68',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1818';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585.03
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 649.68, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 1800;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1818;
UPDATE storedetail SET  productquantity = '112', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2832';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1818', '1', '36', '0', '336', 'اضافة فاتورة مشتريات', 'buyBillController.php', '76', '112', '7', '2026-10-22 13:15:07','0','0'); -- id=16807
UPDATE supplier SET  suppliercurrentDebt = '292956',suppliercurrentDebtInCurrency= '292956' , userid = '7', supplierdate = '2026-10-22 13:21:49'   WHERE supplierid = '136';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('136', '100608.00', '192348', '0', 'اضافة فاتورة مشتريات', '336', '292956', '2026-10-22 13:15:07', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','192348','1','100608','192348','292956','0',''); -- id=885
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '192348', '192348', '2026-10-22', '7', '0', '0', '2026-10-22 13:21:49','اضافة فاتورة مشتريات رقم 336','1','0',null,'0','336','buyBillController.php?do=details&id=336'); -- id=4510
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4510', '382', '192348', '','0'); -- id=4637
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26593811.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4510', '619', '192348', '','0'); -- id=4512
UPDATE accountstree SET name = 'دبل اس', customName = 'دبل اس', customNameEn = 'دبل اس', nameEn = 'دبل اس', parent = '81', accountNature = '1', theValue = '292956', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 18:37:50' WHERE id = '619';
update buybill set dailyentryid='4510,0' where buybillid=336;
COMMIT;
UPDATE product SET overAllAveragePrice = 522 WHERE productId = 1812;UPDATE product SET overAllAveragePrice = 459 WHERE productId = 1813;UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1815;UPDATE product SET overAllAveragePrice = 585 WHERE productId = 1818;UPDATE product SET overAllAveragePrice = 495 WHERE productId = 1822;UPDATE product SET overAllAveragePrice = 432 WHERE productId = 2444;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:51:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:21:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:21:49', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=336'); -- id=18309
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:51:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:21:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:21:53', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=336&type=2'); -- id=18310
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:53:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:23:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-22 13:23:37', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php'); -- id=18311
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:53:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:23:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientReportsController.php', '2026-10-22 13:23:50', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientReportsController.php?do=show'); -- id=18312
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:55:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:25:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:25:24', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=336&type=2'); -- id=18313
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:55:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:25:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:25:26', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18314
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:56:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:26:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:26:26', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18315
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:56:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:26:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:26:26', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18316
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:27:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 13:27:10', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18317
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:10";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 13:27:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 13:27:10', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18318
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:27:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 13:27:11', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18319
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:11";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 13:27:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 13:27:11', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18320
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:27:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:27:13', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18321
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:27:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:27:17', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18322

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e3912c3d9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:27:17', '06ad9e3912c3d9', '1', '0.00', '0', '0', '1', '19680.00', '19680', '19680', '0', '1', '2026-10-22 13:27:17', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '60' ,'0','','','','','-1','0','0','0','0','0','19680','0','','0','0','19680','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1302
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1302', '0', '2026-10-22 13:27:18', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '19680', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:27:17','0','0','',''); -- id=1534
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 6765;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1302', '147', '1886', '12', '320', '3840', '0', '', '0', '2026-10-22 13:27:18', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-7,6989-5,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5232
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5232;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '73', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '12', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '85', '73', '2', '2026-10-22 13:27:18','0','0'); -- id=16808
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6517;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','02207', '1302', '48', '2207', '6', '370', '2220', '0', '', '0', '2026-10-22 13:27:18', '2207', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6517-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=5233
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 5233;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2207, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '3598';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2207', '1', '6', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '9', '2', '2026-10-22 13:27:18','0','0'); -- id=16809
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6518;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02208', '1302', '48', '2208', '6', '350', '2100', '0', '', '0', '2026-10-22 13:27:18', '2208', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6518-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5234
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5234;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2208, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '3599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2208', '1', '6', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '2', '2026-10-22 13:27:18','0','0'); -- id=16810
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 1166;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01972', '1302', '59', '1972', '9', '330', '2970', '0', '', '0', '2026-10-22 13:27:18', '1972', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1166-9,','1','1','0','0','330','2970','0','','0','0.00','0','0','0','0'); -- id=5235
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5235;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '9', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '33', '2', '2026-10-22 13:27:18','0','0'); -- id=16811
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 1170;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01976', '1302', '59', '1976', '12', '320', '3840', '0', '', '0', '2026-10-22 13:27:18', '1976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1170-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5236
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5236;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '12', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '27', '2', '2026-10-22 13:27:18','0','0'); -- id=16812
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1166;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01972', '1302', '59', '1972', '3', '330', '990', '0', '', '0', '2026-10-22 13:27:18', '1972', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1166-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5237
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5237;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '3', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '2', '2026-10-22 13:27:18','0','0'); -- id=16813
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6535;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','09499', '1302', '59', '1205', '12', '310', '3720', '0', '', '0', '2026-10-22 13:27:18', '1205', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6535-12,','1','1','0','0','310','3720','0','','0','0.00','0','0','0','0'); -- id=5238
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 299.38, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 299.38
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 299.38, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5238;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1205, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3720, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3592.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3720, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3592.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 13:27:18' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1205', '1', '12', '1', '1302', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '30', '2', '2026-10-22 13:27:18','0','0'); -- id=16814
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8401791.5',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8382111.5','19680', '0', '2', 'اضافة فاتورة مبيعات', '1302', '8401791.5', '2026-10-22 13:27:18', '2',  'sellbillController.php','1','','0'); -- id=1608
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19680', '19680', '2026-10-22', '2', '0', '0', '2026-10-22 13:27:18','اضافة فاتورة مبيعات رقم 1302','1','0',null,'0','1302','sellbillController.php?do=showDetail&sellbillid=1302'); -- id=4511
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4511', '419', '19680', '','0'); -- id=4638
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8401791.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4511', '143', '19680', '','0'); -- id=4513
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14858080', 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 ( '18516', '18516', '2026-10-22', '2', '0', '0', '2026-10-22 13:27:18','اضافة فاتورة مبيعات رقم 1302 - صرف البضاعة من المخزن','1','0',null,'0','1302','sellbillController.php?do=showDetail&sellbillid=1302'); -- id=4512
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4512', '402', '18516', '','0'); -- id=4639
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13748308.21', 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 ('4512', '382', '18516', '','0'); -- id=4514
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26575295.99', 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='4511,0,4512' where sellbillid=1302;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19680, sellCostBuyPrice =sellCostBuyPrice+18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18940.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19680, sellCostBuyPrice =sellCostBuyPrice+18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18940.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516, 18948, 18940.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19680, netSellCostBuyPrice = netSellCostBuyPrice+18948
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18948
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18940.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18516
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18508.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18516
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18948
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18940.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e3912c3d9 and sellbillId = 1302 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:57:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:27:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:27:18', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18323
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:58:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:28:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:28:20', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18324

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e1c8d5c5f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e1c8d5c5f and sellbillId = 1303 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:58:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:28:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:28:20', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18325
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:59:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:29:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:29:50', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18326
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:59:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:29:50", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:29:50', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18327
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 09:59:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:29:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:29:58', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18328
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:00:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:30:09", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:30:09', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18329
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:00:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:30:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 13:30:20', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=18330
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:00:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:30:49", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:30:49', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18331
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:09", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:09', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18332

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e5444be15
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e5444be15 and sellbillId = 1304 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:09", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:09', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18333
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:13', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18334
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:14", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:14', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18335
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:19", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:19', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18336

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e4d24d388
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:31:19', '06ad9e4d24d388', '1', '0.00', '0', '0', '1', '10950.00', '10950', '10950', '0', '1', '2026-10-22 13:31:19', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '36' ,'0','','','','','-1','0','0','0','0','0','10950','0','','0','0','10950','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1305
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1305', '0', '2026-10-22 13:31:19', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10950', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:31:19','0','0','',''); -- id=1537
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 1085;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','01924', '1305', '154', '1924', '18', '295', '5310', '0', '', '0', '2026-10-22 13:31:19', '1924', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1085-18,','1','1','0','0','295','5310','0','','0','0.00','0','0','0','0'); -- id=5241
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 5241;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1924, '2026-10-22', 5310, 4950, 4950
                    , 4950, 4950, 4950, 4950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5310, 4950, 4950
                    , 4950, 4950, 4950, 4950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4950, 4950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5310, sellCostBuyPrice =sellCostBuyPrice+4950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '186', userid = '3', storedetaildate = '2026-10-22 13:31:19' WHERE storedetailid = '2941';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1924', '1', '18', '1', '1305', 'اضافة فاتورة مبيعات', 'sellbillController.php', '204', '186', '3', '2026-10-22 13:31:19','0','0'); -- id=16817
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6988;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('261','02358', '1305', '105', '2358', '12', '290', '3480', '0', '', '0', '2026-10-22 13:31:19', '2358', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6988-12,','1','1','0','0','290','3480','0','','0','0.00','0','0','0','0'); -- id=5242
UPDATE sellbilldetail SET  lastbuyprice = 290.00 , meanbuyprice = 290.00, lastbuyprice_withDiscount = 261.00, meanbuyprice_withDiscount = 261.00
        , lastbuyprice_withTax = 290, meanbuyprice_withTax = 290, lastbuyprice_withDiscountAndTax = 261
                where sellbilldetailid = 5242;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2358, '2026-10-22', 3480, 3480, 3480
                    , 3480, 3132, 3132, 3132
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3132, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3132
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3132
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3480, 3480, 3480
                    , 3480, 3132, 3132, 3132
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3480, 3480, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3480, sellCostBuyPrice =sellCostBuyPrice+3480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3132, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3132
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3132
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3480
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '3', storedetaildate = '2026-10-22 13:31:19' WHERE storedetailid = '3752';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2358', '1', '12', '1', '1305', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '6', '3', '2026-10-22 13:31:19','0','0'); -- id=16818
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7053;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('334.8','02393', '1305', '189', '2393', '6', '360', '2160', '0', '', '0', '2026-10-22 13:31:19', '2393', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7053-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5243
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 334.80, meanbuyprice_withDiscount = 334.80
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 334.8
                where sellbilldetailid = 5243;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2393, '2026-10-22', 2160, 2160, 2160
                    , 2160, 2008.8, 2008.8, 2008.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2008.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2008.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2008.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 2160, 2160
                    , 2160, 2008.8, 2008.8, 2008.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2008.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2008.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2008.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '3', storedetaildate = '2026-10-22 13:31:19' WHERE storedetailid = '3788';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2393', '1', '6', '1', '1305', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '3', '2026-10-22 13:31:19','0','0'); -- id=16819
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8412742',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8401792','10950', '0', '2', 'اضافة فاتورة مبيعات', '1305', '8412742', '2026-10-22 13:31:19', '3',  'sellbillController.php','1','','0'); -- id=1611
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10950', '10950', '2026-10-22', '3', '0', '0', '2026-10-22 13:31:19','اضافة فاتورة مبيعات رقم 1305','1','0',null,'0','1305','sellbillController.php?do=showDetail&sellbillid=1305'); -- id=4517
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4517', '419', '10950', '','0'); -- id=4644
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8412741.2', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4517', '143', '10950', '','0'); -- id=4519
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14881155', 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 ( '10090.8', '10090.8', '2026-10-22', '3', '0', '0', '2026-10-22 13:31:19','اضافة فاتورة مبيعات رقم 1305 - صرف البضاعة من المخزن','1','0',null,'0','1305','sellbillController.php?do=showDetail&sellbillid=1305'); -- id=4518
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4518', '402', '10090.8', '','0'); -- id=4645
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13768099.01', 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 ('4518', '382', '10090.8', '','0'); -- id=4520
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26555505.19', 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='4517,0,4518' where sellbillid=1305;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10950, 10590, 10590
                    , 10590, 10090.8, 10090.8, 10090.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10590, 10590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10950, sellCostBuyPrice =sellCostBuyPrice+10590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10090.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10090.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10090.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10950, 10590, 10590
                    , 10590, 10090.8, 10090.8, 10090.8
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10590, 10590, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10950, sellCostBuyPrice =sellCostBuyPrice+10590
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10590, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10590
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10090.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10090.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10090.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10590
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10590
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 10950, 10590, 10590
                    , 10590, 10090.8, 10090.8, 10090.8, 10590, 10590)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10950, netSellCostBuyPrice = netSellCostBuyPrice+10590
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10590
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10590
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10090.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10090.8
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10090.8
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10590
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10590;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e4d24d388 and sellbillId = 1305 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:20", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:20', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18337
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:51", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:51', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18338

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e5064e3d2
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e5064e3d2 and sellbillId = 1306 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:01:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:31:51", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:31:51', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18339
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:05:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:35:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:35:03', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18340
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:05:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:35:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:35:03', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18341
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:05:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:35:05", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:35:05', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18342

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e5edc08e7
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e5edc08e7 and sellbillId = 1307 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9dbb99a2e2
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9dbb99a2e2 and sellbillId = 1308 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:10:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:40:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:40:11', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18345
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:10:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:40:20", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:40:20', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18346
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:11:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:41:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:41:23', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18347
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:11:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:41:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:41:24', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18348
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:12:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:42:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:42:03', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18349
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:12:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:42:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:42:04', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18350
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:16:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:46:16", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 13:46:16', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18351
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:16:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:46:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:46:18', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18352
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:19:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:49:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:49:55', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18353
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:19:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:49:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:49:55', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18354
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:21:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:51:39", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:51:39', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18355

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e8148ad04
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:51:39', '06ad9e8148ad04', '1', '0.00', '0', '0', '1', '23970.00', '23970', '23970', '0', '1', '2026-10-22 13:51:39', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '30' ,'0','','','','','-1','0','0','0','0','0','23970','0','','0','0','23970','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1309
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1309', '0', '2026-10-22 13:51:39', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '23970', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:51:39','0','0','',''); -- id=1541
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 1209;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01990', '1309', '161', '1990', '12', '850', '10200', '0', '', '0', '2026-10-22 13:51:39', '1990', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1209-12,','1','1','0','0','850','10200','0','','0','0.00','0','0','0','0'); -- id=5249
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5249;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1990, '2026-10-22', 10200, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10200, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10200, 9600, 9600
                    , 9600, 9600, 9600, 9600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9600, 9600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10200, sellCostBuyPrice =sellCostBuyPrice+9600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9600
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '126', userid = '6', storedetaildate = '2026-10-22 13:51:39' WHERE storedetailid = '3007';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1990', '1', '12', '1', '1309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '138', '126', '6', '2026-10-22 13:51:39','0','0'); -- id=16825
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 5975;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('730','02011', '1309', '163', '2011', '9', '780', '7020', '0', '', '0', '2026-10-22 13:51:39', '2011', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5975-9,','1','1','0','0','780','7020','0','','0','0.00','0','0','0','0'); -- id=5250
UPDATE sellbilldetail SET  lastbuyprice = 730.00 , meanbuyprice = 730.00, lastbuyprice_withDiscount = 730.00, meanbuyprice_withDiscount = 730.00
        , lastbuyprice_withTax = 730, meanbuyprice_withTax = 292, lastbuyprice_withDiscountAndTax = 730
                where sellbilldetailid = 5250;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2011, '2026-10-22', 7020, 6570, 6570
                    , 6570, 6570, 6570, 6570
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6570, 2628, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7020, sellCostBuyPrice =sellCostBuyPrice+6570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6570
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6570
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2628
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 7020, 6570, 6570
                    , 6570, 6570, 6570, 6570
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6570, 2628, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+7020, sellCostBuyPrice =sellCostBuyPrice+6570
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6570, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6570
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6570, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6570
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6570
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6570
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2628
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '6', storedetaildate = '2026-10-22 13:51:39' WHERE storedetailid = '3369';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2011', '1', '9', '1', '1309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '3', '6', '2026-10-22 13:51:39','0','0'); -- id=16826
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6198;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('700','02116', '1309', '181', '2116', '9', '750', '6750', '0', '', '0', '2026-10-22 13:51:39', '2116', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6198-9,','1','1','0','0','750','6750','0','','0','0.00','0','0','0','0'); -- id=5251
UPDATE sellbilldetail SET  lastbuyprice = 700.00 , meanbuyprice = 700.00, lastbuyprice_withDiscount = 700.00, meanbuyprice_withDiscount = 700.00
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 700, lastbuyprice_withDiscountAndTax = 700
                where sellbilldetailid = 5251;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2116, '2026-10-22', 6750, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 6300, 6300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6750, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6300, 6300, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6750, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6300
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '6', storedetaildate = '2026-10-22 13:51:39' WHERE storedetailid = '3475';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2116', '1', '9', '1', '1309', 'اضافة فاتورة مبيعات', 'sellbillController.php', '57', '48', '6', '2026-10-22 13:51:39','0','0'); -- id=16827
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1269975',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1246005','23970', '0', '4', 'اضافة فاتورة مبيعات', '1309', '1269975', '2026-10-22 13:51:39', '6',  'sellbillController.php','1','','0'); -- id=1615
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '23970', '23970', '2026-10-22', '6', '0', '0', '2026-10-22 13:51:39','اضافة فاتورة مبيعات رقم 1309','1','0',null,'0','1309','sellbillController.php?do=showDetail&sellbillid=1309'); -- id=4525
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4525', '568', '23970', '','0'); -- id=4652
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1269975', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4525', '143', '23970', '','0'); -- id=4527
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14920525', 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 ( '22470', '22470', '2026-10-22', '6', '0', '0', '2026-10-22 13:51:39','اضافة فاتورة مبيعات رقم 1309 - صرف البضاعة من المخزن','1','0',null,'0','1309','sellbillController.php?do=showDetail&sellbillid=1309'); -- id=4526
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4526', '402', '22470', '','0'); -- id=4653
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13804569.01', 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 ('4526', '382', '22470', '','0'); -- id=4528
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26523035.19', 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='4525,0,4526' where sellbillid=1309;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 23970, 22470, 22470
                    , 22470, 22470, 22470, 22470
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22470, 18528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23970, sellCostBuyPrice =sellCostBuyPrice+22470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 23970, 22470, 22470
                    , 22470, 22470, 22470, 22470
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,22470, 18528, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+23970, sellCostBuyPrice =sellCostBuyPrice+22470
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+22470, sellCostMeanBuyPrice = sellCostMeanBuyPrice+22470
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22470, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22470
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22470
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+22470
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18528
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 23970, 22470, 22470
                    , 22470, 22470, 22470, 22470, 22470, 18528)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+23970, netSellCostBuyPrice = netSellCostBuyPrice+22470
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+22470
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+22470
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+22470
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+22470
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+22470
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+22470
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18528;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e8148ad04 and sellbillId = 1309 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:21:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:51:39", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:51:39', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18356
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:22:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:52:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 13:52:54', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18357
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:22:55";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 13:52:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 13:52:55', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18358
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:22:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:52:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:52:56', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18359
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:53:07', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18360

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e617af666
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:53:07', '06ad9e617af666', '1', '0.00', '0', '1', '2', '42105.00', '41683.95', '41683.95', '0', '1', '2026-10-22 13:53:07', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '105' ,'0','','','','','-1','0','0','0','0','0','41683','0','','0','0','41683.95','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1310
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1310', '0', '2026-10-22 13:53:07', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '41683.95', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:53:07','0','0','',''); -- id=1542
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1310', '190', '2176', '12', '330', '3960', '0', '', '0', '2026-10-22 13:53:07', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-12,','1','1','0','0','330','3960','0','','0','0.00','0','0','0','0'); -- id=5252
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5252;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 3920.4, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3920.4, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3920.4, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3920.4, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '80', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '12', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '92', '80', '2', '2026-10-22 13:53:07','0','0'); -- id=16828
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 1085;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','01924', '1310', '154', '1924', '6', '295', '1770', '0', '', '0', '2026-10-22 13:53:07', '1924', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1085-6,','1','1','0','0','295','1770','0','','0','0.00','0','0','0','0'); -- id=5253
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 5253;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1924, '2026-10-22', 1752.3, 1650, 1650
                    , 1650, 1650, 1650, 1650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1752.3, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1752.3, 1650, 1650
                    , 1650, 1650, 1650, 1650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1650, 1650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1752.3, sellCostBuyPrice =sellCostBuyPrice+1650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '180', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '2941';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1924', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '186', '180', '2', '2026-10-22 13:53:07','0','0'); -- id=16829
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 5982;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','02015', '1310', '115', '2015', '6', '400', '2400', '0', '', '0', '2026-10-22 13:53:07', '2015', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5982-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=5254
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 5254;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2015, '2026-10-22', 2376, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2376, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2376, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2376, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3374';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2015', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '2', '2026-10-22 13:53:07','0','0'); -- id=16830
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1310', '153', '1921', '6', '485', '2910', '0', '', '0', '2026-10-22 13:53:07', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-6,','1','1','0','0','485','2910','0','','0','0.00','0','0','0','0'); -- id=5255
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5255;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 2880.9, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880.9, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880.9, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880.9, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '2', '2026-10-22 13:53:07','0','0'); -- id=16831
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6020;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('414','02030', '1310', '166', '2030', '9', '450', '4050', '0', '', '0', '2026-10-22 13:53:07', '2030', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6020-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5256
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 415.38
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 5256;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2030, '2026-10-22', 4009.5, 4050, 4050
                    , 4050, 3766.5, 3738.42, 3736.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4009.5, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3738.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3736.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4009.5, 4050, 4050
                    , 4050, 3766.5, 3738.42, 3736.08
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4009.5, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3766.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3738.42
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3736.08
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '108', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3389';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2030', '1', '9', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '117', '108', '2', '2026-10-22 13:53:07','0','0'); -- id=16832
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6954;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.75','02340', '1310', '166', '2340', '6', '475', '2850', '0', '', '0', '2026-10-22 13:53:07', '2340', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6954-6,','1','1','0','0','475','2850','0','','0','0.00','0','0','0','0'); -- id=5257
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 441.75, meanbuyprice_withDiscount = 441.75
        , lastbuyprice_withTax = 475, meanbuyprice_withTax = 475, lastbuyprice_withDiscountAndTax = 441.75
                where sellbilldetailid = 5257;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2340, '2026-10-22', 2821.5, 2850, 2850
                    , 2850, 2650.5, 2650.5, 2650.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2821.5, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2821.5, 2850, 2850
                    , 2850, 2650.5, 2650.5, 2650.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2850, 2850, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2821.5, sellCostBuyPrice =sellCostBuyPrice+2850
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2850, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2850
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2850
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2850
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3734';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2340', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '18', '2', '2026-10-22 13:53:07','0','0'); -- id=16833
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6847;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','02308', '1310', '169', '2308', '6', '280', '1680', '0', '', '0', '2026-10-22 13:53:07', '2308', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6847-6,','1','1','0','0','280','1680','0','','0','0.00','0','0','0','0'); -- id=5258
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 130, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 5258;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2308, '2026-10-22', 1663.2, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1560, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1663.2, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1663.2, 1560, 1560
                    , 1560, 1560, 1560, 1560
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1663.2, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1560, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1560
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1560
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3701';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2308', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 13:53:07','0','0'); -- id=16834
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 1119;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01932', '1310', '102', '1932', '9', '330', '2970', '0', '', '0', '2026-10-22 13:53:07', '1932', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1119-9,','1','1','0','0','330','2970','0','','0','0.00','0','0','0','0'); -- id=5259
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5259;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1932, '2026-10-22', 2940.3, 2790, 2790
                    , 2790, 2790, 2790, 2790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2790, 2790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940.3, sellCostBuyPrice =sellCostBuyPrice+2790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2940.3, 2790, 2790
                    , 2790, 2790, 2790, 2790
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2790, 2790, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2940.3, sellCostBuyPrice =sellCostBuyPrice+2790
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2790, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2790
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2790, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2790
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2790
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2790
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2790
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '2949';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1932', '1', '9', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '96', '87', '2', '2026-10-22 13:53:07','0','0'); -- id=16835
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1310', '147', '2359', '9', '425', '3825', '0', '', '0', '2026-10-22 13:53:07', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-9,','1','1','0','0','425','3825','0','','0','0.00','0','0','0','0'); -- id=5260
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5260;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 3786.75, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3786.75, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3786.75, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3786.75, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '9', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '24', '2', '2026-10-22 13:53:07','0','0'); -- id=16836
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1310', '166', '2028', '9', '320', '2880', '0', '', '0', '2026-10-22 13:53:07', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5261
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5261;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 2851.2, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2851.2, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2851.2, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2851.2, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '9', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '111', '102', '2', '2026-10-22 13:53:07','0','0'); -- id=16837
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1310', '207', '2380', '6', '450', '2700', '0', '', '0', '2026-10-22 13:53:07', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5262
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5262;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 2673, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2673, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2673, 2580, 2580
                    , 2580, 2580, 2580, 2580
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2673, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2580, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2580
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2580
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '189', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '195', '189', '2', '2026-10-22 13:53:07','0','0'); -- id=16838
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7082;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('483.6','02410', '1310', '210', '2410', '6', '520', '3120', '0', '', '0', '2026-10-22 13:53:07', '2410', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7082-6,','1','1','0','0','520','3120','0','','0','0.00','0','0','0','0'); -- id=5263
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 483.60, meanbuyprice_withDiscount = 483.60
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 483.6
                where sellbilldetailid = 5263;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2410, '2026-10-22', 3088.8, 3120, 3120
                    , 3120, 2901.6, 2901.6, 2901.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3088.8, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2901.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2901.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2901.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3088.8, 3120, 3120
                    , 3120, 2901.6, 2901.6, 2901.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3120, 3120, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3088.8, sellCostBuyPrice =sellCostBuyPrice+3120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3120
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2901.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2901.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2901.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3120
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3805';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2410', '1', '6', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '84', '78', '2', '2026-10-22 13:53:07','0','0'); -- id=16839
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1310', '207', '2381', '12', '470', '5640', '0', '', '0', '2026-10-22 13:53:07', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-12,','1','1','0','0','470','5640','0','','0','0.00','0','0','0','0'); -- id=5264
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5264;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 5583.6, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5583.6, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5583.6, 5400, 5400
                    , 5400, 5400, 5400, 5400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5400, 5400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5583.6, sellCostBuyPrice =sellCostBuyPrice+5400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '305', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '12', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '317', '305', '2', '2026-10-22 13:53:07','0','0'); -- id=16840
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1310', '207', '2380', '3', '450', '1350', '0', '', '0', '2026-10-22 13:53:07', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5265
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5265;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 1336.5, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1336.5, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1336.5, 1290, 1290
                    , 1290, 1290, 1290, 1290
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1336.5, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1290, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1290
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1290
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '186', userid = '2', storedetaildate = '2026-10-22 13:53:07' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '3', '1', '1310', 'اضافة فاتورة مبيعات', 'sellbillController.php', '189', '186', '2', '2026-10-22 13:53:07','0','0'); -- id=16841
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8460975.95',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8419292','41683.95', '0', '2', 'اضافة فاتورة مبيعات', '1310', '8460975.95', '2026-10-22 13:53:07', '2',  'sellbillController.php','1','','0'); -- id=1616
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '42105', '42105', '2026-10-22', '2', '0', '0', '2026-10-22 13:53:07','اضافة فاتورة مبيعات رقم 1310','1','0',null,'0','1310','sellbillController.php?do=showDetail&sellbillid=1310'); -- id=4527
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4527', '419', '41683.95', '','0'); -- id=4654
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8460975.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4527', '398', '421.05', '','0'); -- id=4655
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '511786.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4527', '143', '42105', '','0'); -- id=4529
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14962630', 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 ( '39525', '39525', '2026-10-22', '2', '0', '0', '2026-10-22 13:53:07','اضافة فاتورة مبيعات رقم 1310 - صرف البضاعة من المخزن','1','0',null,'0','1310','sellbillController.php?do=showDetail&sellbillid=1310'); -- id=4528
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4528', '402', '39525', '','0'); -- id=4656
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13844094.01', 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 ('4528', '382', '39525', '','0'); -- id=4530
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26483510.19', 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='4527,0,4528' where sellbillid=1310;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 41683.95, 40596, 40596
                    , 40596, 39525, 39496.92, 39488.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,40596, 39816, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+41683.95, sellCostBuyPrice =sellCostBuyPrice+40596
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40596, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40596
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39496.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39488.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40596
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39816
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 41683.95, 40596, 40596
                    , 40596, 39525, 39496.92, 39488.82
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,40596, 39816, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+41683.95, sellCostBuyPrice =sellCostBuyPrice+40596
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+40596, sellCostMeanBuyPrice = sellCostMeanBuyPrice+40596
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+39525, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+39496.92
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+39488.82
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+40596
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+39816
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 41683.95, 40596, 40596
                    , 40596, 39525, 39496.92, 39488.82, 40596, 39816)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+41683.95, netSellCostBuyPrice = netSellCostBuyPrice+40596
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+40596
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+40596
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+39525
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+39496.92
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+39488.82
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+40596
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+39816;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e617af666 and sellbillId = 1310 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:53:07', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18361
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:53:10', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18362
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:10", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:53:10', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18363
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 13:53:36', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18364
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:23:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:53:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:53:51', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18365
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 13:54:01', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18366
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('احمد شحاتة','2026-10-22','','90', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=214
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (214, 1,'2026-10-22 13:54:01',7)
                ON DUPLICATE KEY UPDATE catid = 214, edited = 1, sysdate = '2026-10-22 13:54:01', userid = 7; -- id=229
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '214', '1', '2026-10-22', '7', '0'); -- id=104
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 13:54:01', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18367
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 13:54:03', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18368
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:54:06', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18369
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:54:06', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18370
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:16", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:54:16', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18371

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e97ab8ce3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:54:16', '06ad9e97ab8ce3', '1', '0.00', '0', '0', '1', '15660.00', '15660', '15660', '0', '1', '2026-10-22 13:54:16', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '21' ,'0','','','','','-1','0','0','0','0','0','15660','0','','0','0','15660','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1311
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1311', '0', '2026-10-22 13:54:16', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15660', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:54:16','0','0','',''); -- id=1543
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6541;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','02230', '1311', '194', '2230', '6', '560', '3360', '0', '', '0', '2026-10-22 13:54:16', '2230', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6541-6,','1','1','0','0','560','3360','0','','0','0.00','0','0','0','0'); -- id=5266
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 5266;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2230, '2026-10-22', 3360, 3180, 3180
                    , 3180, 3180, 3180, 3180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3180, 3180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3360, 3180, 3180
                    , 3180, 3180, 3180, 3180
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3180, 3180, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3360, sellCostBuyPrice =sellCostBuyPrice+3180
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3180, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3180
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3180, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3180
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3180
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3180
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3180
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '6', storedetaildate = '2026-10-22 13:54:16' WHERE storedetailid = '3621';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2230', '1', '6', '1', '1311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '9', '6', '2026-10-22 13:54:16','0','0'); -- id=16842
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 648;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('900','01735', '1311', '133', '1735', '7', '900', '6300', '0', '', '0', '2026-10-22 13:54:16', '1735', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','648-7,','1','1','0','0','900','6300','0','','0','0.00','0','0','0','0'); -- id=5267
UPDATE sellbilldetail SET  lastbuyprice = 900.00 , meanbuyprice = 900.00, lastbuyprice_withDiscount = 900.00, meanbuyprice_withDiscount = 900.00
        , lastbuyprice_withTax = 900, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 900
                where sellbilldetailid = 5267;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1735, '2026-10-22', 6300, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7, 0, 6300, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6300, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+7
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6300, 6300, 6300
                    , 6300, 6300, 6300, 6300
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6300, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6300, sellCostBuyPrice =sellCostBuyPrice+6300
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6300, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6300
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6300, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6300
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6300
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6300
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '6', storedetaildate = '2026-10-22 13:54:16' WHERE storedetailid = '2748';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1735', '1', '7', '1', '1311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '1', '6', '2026-10-22 13:54:16','0','0'); -- id=16843
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 647;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('750','01734', '1311', '133', '1734', '8', '750', '6000', '0', '', '0', '2026-10-22 13:54:16', '1734', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','647-8,','1','1','0','0','750','6000','0','','0','0.00','0','0','0','0'); -- id=5268
UPDATE sellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where sellbilldetailid = 5268;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-22', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6000, 6000, 6000
                    , 6000, 6000, 6000, 6000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6000, 6000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+6000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '6', storedetaildate = '2026-10-22 13:54:16' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '8', '1', '1311', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '48', '6', '2026-10-22 13:54:16','0','0'); -- id=16844
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1285635',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1269975','15660', '0', '4', 'اضافة فاتورة مبيعات', '1311', '1285635', '2026-10-22 13:54:16', '6',  'sellbillController.php','1','','0'); -- id=1617
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15660', '15660', '2026-10-22', '6', '0', '0', '2026-10-22 13:54:16','اضافة فاتورة مبيعات رقم 1311','1','0',null,'0','1311','sellbillController.php?do=showDetail&sellbillid=1311'); -- id=4529
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4529', '568', '15660', '','0'); -- id=4657
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1285635', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4529', '143', '15660', '','0'); -- id=4531
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '14978290', 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 ( '15480', '15480', '2026-10-22', '6', '0', '0', '2026-10-22 13:54:16','اضافة فاتورة مبيعات رقم 1311 - صرف البضاعة من المخزن','1','0',null,'0','1311','sellbillController.php?do=showDetail&sellbillid=1311'); -- id=4530
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4530', '402', '15480', '','0'); -- id=4658
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13859574.01', 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 ('4530', '382', '15480', '','0'); -- id=4532
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26468030.19', 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='4529,0,4530' where sellbillid=1311;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15660, 15480, 15480
                    , 15480, 15480, 15480, 15480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15480, 12330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15660, sellCostBuyPrice =sellCostBuyPrice+15480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15660, 15480, 15480
                    , 15480, 15480, 15480, 15480
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,15480, 12330, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15660, sellCostBuyPrice =sellCostBuyPrice+15480
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+15480, sellCostMeanBuyPrice = sellCostMeanBuyPrice+15480
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15480, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15480
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15480
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+15480
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12330
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 15660, 15480, 15480
                    , 15480, 15480, 15480, 15480, 15480, 12330)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15660, netSellCostBuyPrice = netSellCostBuyPrice+15480
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+15480
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+15480
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15480
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15480
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15480
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+15480
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12330;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e97ab8ce3 and sellbillId = 1311 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e5f81855a
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:54:31', '06ad9e5f81855a', '1', '0.00', '0', '0', '1', '48700.00', '48700', '48700', '0', '1', '2026-10-22 13:54:31', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '125' ,'0','','','','','-1','0','0','0','0','0','48700','0','','0','0','48700','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1312
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1312', '0', '2026-10-22 13:54:31', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '48700', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:54:31','0','0','',''); -- id=1544
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1312', '207', '2380', '9', '450', '4050', '0', '', '0', '2026-10-22 13:54:31', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5269
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5269;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 4050, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4050, 3870, 3870
                    , 3870, 3870, 3870, 3870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '177', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '9', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '186', '177', '3', '2026-10-22 13:54:31','0','0'); -- id=16845
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1312', '207', '2381', '9', '470', '4230', '0', '', '0', '2026-10-22 13:54:31', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-9,','1','1','0','0','470','4230','0','','0','0.00','0','0','0','0'); -- id=5270
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5270;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 4230, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4230, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4230, 4050, 4050
                    , 4050, 4050, 4050, 4050
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 4050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4230, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4050, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4050
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4050
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '296', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '9', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '305', '296', '3', '2026-10-22 13:54:31','0','0'); -- id=16846
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 998;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7049;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','01904', '1312', '149', '1904', '9', '350', '3150', '0', '', '0', '2026-10-22 13:54:31', '1904', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','998-6,7049-3,','1','1','0','0','350','3150','0','','0','0.00','0','0','0','0'); -- id=5271
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 324.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5271;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1904, '2026-10-22', 3150, 3150, 3150
                    , 3150, 2898, 2916, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3150, 2925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2916
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3150, 3150, 3150
                    , 3150, 2898, 2916, 2898
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3150, 2925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+3150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2898, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2916
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2898
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '2921';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1904', '1', '9', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '42', '33', '3', '2026-10-22 13:54:31','0','0'); -- id=16847
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1312', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 13:54:31', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=5272
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5272;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '290', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '296', '290', '3', '2026-10-22 13:54:31','0','0'); -- id=16848
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','0188401886', '1312', '147', '1886', '9', '320', '2880', '0', '', '0', '2026-10-22 13:54:31', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6989-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5273
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5273;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 2880, 2601, 2601
                    , 2601, 2601, 2601, 2601
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2601, 2601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2601, 2601
                    , 2601, 2601, 2601, 2601
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2601, 2601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '64', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '9', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '73', '64', '3', '2026-10-22 13:54:31','0','0'); -- id=16849
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 978;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6764;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('429','01884', '1312', '147', '1884', '24', '460', '11040', '0', '', '0', '2026-10-22 13:54:31', '1884', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','978-18,6764-6,','1','1','0','0','460','11040','0','','0','0.00','0','0','0','0'); -- id=5274
UPDATE sellbilldetail SET  lastbuyprice = 429.00 , meanbuyprice = 429.00, lastbuyprice_withDiscount = 429.00, meanbuyprice_withDiscount = 429.00
        , lastbuyprice_withTax = 429, meanbuyprice_withTax = 429, lastbuyprice_withDiscountAndTax = 429
                where sellbilldetailid = 5274;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1884, '2026-10-22', 11040, 10296, 10296
                    , 10296, 10296, 10296, 10296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 10296, 10296, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11040, sellCostBuyPrice =sellCostBuyPrice+10296
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10296, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10296
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10296
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10296
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 11040, 10296, 10296
                    , 10296, 10296, 10296, 10296
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10296, 10296, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11040, sellCostBuyPrice =sellCostBuyPrice+10296
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10296, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10296
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10296, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10296
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10296
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10296
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10296
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '138', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '2901';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1884', '1', '24', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '162', '138', '3', '2026-10-22 13:54:31','0','0'); -- id=16850
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 855;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','01830', '1312', '48', '1830', '15', '350', '5250', '0', '', '0', '2026-10-22 13:54:31', '1830', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','855-15,','1','1','0','0','350','5250','0','','0','0.00','0','0','0','0'); -- id=5275
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 332.50
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5275;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1830, '2026-10-22', 5250, 5250, 5250
                    , 5250, 4725, 4987.5, 4725
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5250, 2625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5250, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4725, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4987.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4725
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5250, 5250, 5250
                    , 5250, 4725, 4987.5, 4725
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5250, 2625, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5250, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4725, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4987.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4725
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2625
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '2845';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1830', '1', '15', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '0', '3', '2026-10-22 13:54:31','0','0'); -- id=16851
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6755;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('312.8','02271', '1312', '71', '2271', '12', '340', '4080', '0', '', '0', '2026-10-22 13:54:31', '2271', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6755-12,','1','1','0','0','340','4080','0','','0','0.00','0','0','0','0'); -- id=5276
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 312.80, meanbuyprice_withDiscount = 312.80
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 312.8
                where sellbilldetailid = 5276;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2271, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4080, 4080, 4080
                    , 4080, 3753.6, 3753.6, 3753.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4080, 4080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4080, sellCostBuyPrice =sellCostBuyPrice+4080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3753.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3753.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3753.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '74', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3664';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2271', '1', '12', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '86', '74', '3', '2026-10-22 13:54:31','0','0'); -- id=16852
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6757;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02272', '1312', '71', '2272', '8', '350', '2800', '0', '', '0', '2026-10-22 13:54:31', '2272', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6757-8,','1','1','0','0','350','2800','0','','0','0.00','0','0','0','0'); -- id=5277
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5277;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2272, '2026-10-22', 2800, 2800, 2800
                    , 2800, 2576, 2576, 2576
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2576, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2576
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2576
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2800, 2800, 2800
                    , 2800, 2576, 2576, 2576
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2576, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2576
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2576
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3665';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2272', '1', '8', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64', '56', '3', '2026-10-22 13:54:31','0','0'); -- id=16853
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6517;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','02207', '1312', '48', '2207', '6', '370', '2220', '0', '', '0', '2026-10-22 13:54:31', '2207', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6517-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=5278
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 5278;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2207, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3598';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2207', '1', '6', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '3', '2026-10-22 13:54:31','0','0'); -- id=16854
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6738;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297','02263', '1312', '200', '2263', '6', '330', '1980', '0', '', '0', '2026-10-22 13:54:31', '2263', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6738-6,','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=5279
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 297.00, meanbuyprice_withDiscount = 297.00
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 330, lastbuyprice_withDiscountAndTax = 297
                where sellbilldetailid = 5279;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2263, '2026-10-22', 1980, 1980, 1980
                    , 1980, 1782, 1782, 1782
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1980, 1980, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1980
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1782, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1782
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1782
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1980
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1980, 1980, 1980
                    , 1980, 1782, 1782, 1782
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1980, 1980, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1980
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1782, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1782
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1782
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1980
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3656';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2263', '1', '6', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '9', '3', '2026-10-22 13:54:31','0','0'); -- id=16855
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 853;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','01828', '1312', '48', '1828', '6', '360', '2160', '0', '', '0', '2026-10-22 13:54:31', '1828', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','853-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5280
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 342.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 180, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 5280;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1828, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 2052, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2052
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 2052, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2052
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '2843';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1828', '1', '6', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '27', '3', '2026-10-22 13:54:31','0','0'); -- id=16856
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6645;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02242', '1312', '72', '2242', '6', '340', '2040', '0', '', '0', '2026-10-22 13:54:31', '2242', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6645-6,','1','1','0','0','340','2040','0','','0','0.00','0','0','0','0'); -- id=5281
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 306.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 340, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5281;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2242, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2040, 2040, 2040
                    , 2040, 1836, 1836, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 2040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2040, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1836
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '3', storedetaildate = '2026-10-22 13:54:31' WHERE storedetailid = '3633';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2242', '1', '6', '1', '1312', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '3', '2026-10-22 13:54:31','0','0'); -- id=16857
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8509676',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8460976','48700', '0', '2', 'اضافة فاتورة مبيعات', '1312', '8509676', '2026-10-22 13:54:31', '3',  'sellbillController.php','1','','0'); -- id=1618
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '48700', '48700', '2026-10-22', '3', '0', '0', '2026-10-22 13:54:31','اضافة فاتورة مبيعات رقم 1312','1','0',null,'0','1312','sellbillController.php?do=showDetail&sellbillid=1312'); -- id=4531
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4531', '419', '48700', '','0'); -- id=4659
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8509675.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4531', '143', '48700', '','0'); -- id=4533
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15026990', 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 ( '45029.6', '45029.6', '2026-10-22', '3', '0', '0', '2026-10-22 13:54:31','اضافة فاتورة مبيعات رقم 1312 - صرف البضاعة من المخزن','1','0',null,'0','1312','sellbillController.php?do=showDetail&sellbillid=1312'); -- id=4532
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4532', '402', '45029.6', '','0'); -- id=4660
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13904603.61', 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 ('4532', '382', '45029.6', '','0'); -- id=4534
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26423000.59', 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='4531,0,4532' where sellbillid=1312;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 48700, 47197, 47197
                    , 47197, 45029.6, 45418.1, 45029.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,47197, 43267, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48700, sellCostBuyPrice =sellCostBuyPrice+47197
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47197, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47197
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45029.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45418.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45029.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47197
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43267
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 48700, 47197, 47197
                    , 47197, 45029.6, 45418.1, 45029.6
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,47197, 43267, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+48700, sellCostBuyPrice =sellCostBuyPrice+47197
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+47197, sellCostMeanBuyPrice = sellCostMeanBuyPrice+47197
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+45029.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+45418.1
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+45029.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+47197
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+43267
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 48700, 47197, 47197
                    , 47197, 45029.6, 45418.1, 45029.6, 47197, 43267)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+48700, netSellCostBuyPrice = netSellCostBuyPrice+47197
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+47197
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+47197
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+45029.6
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+45418.1
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+45029.6
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+47197
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+43267;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e5f81855a and sellbillId = 1312 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:31", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:54:31', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18374
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:43", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:54:43', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18375

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e6d965f65
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:54:43', '06ad9e6d965f65', '1', '0.00', '0', '0', '1', '21300.00', '21300', '21300', '0', '1', '2026-10-22 13:54:43', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '38' ,'0','','','','','-1','0','0','0','0','0','21300','0','','0','0','21300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1313
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1313', '0', '2026-10-22 13:54:43', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '21300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:54:43','0','0','',''); -- id=1545
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 561;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7111;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01698', '1313', '130', '1698', '18', '850', '15300', '0', '', '0', '2026-10-22 13:54:43', '1698', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','561-15,7111-3,','1','1','0','0','850','15300','0','','0','0.00','0','0','0','0'); -- id=5282
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5282;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15300, sellCostBuyPrice =sellCostBuyPrice+14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15300, sellCostBuyPrice =sellCostBuyPrice+14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '72', userid = '6', storedetaildate = '2026-10-22 13:54:43' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '18', '1', '1313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '72', '6', '2026-10-22 13:54:43','0','0'); -- id=16858
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 60;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('240','01375', '1313', '91', '1375', '20', '300', '6000', '0', '', '0', '2026-10-22 13:54:43', '1375', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','60-20,','1','1','0','0','300','6000','0','','0','0.00','0','0','0','0'); -- id=5283
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 240
                where sellbilldetailid = 5283;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1375, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '92', userid = '6', storedetaildate = '2026-10-22 13:54:43' WHERE storedetailid = '1375';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1375', '1', '20', '1', '1313', 'اضافة فاتورة مبيعات', 'sellbillController.php', '112', '92', '6', '2026-10-22 13:54:43','0','0'); -- id=16859
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1306935',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1285635','21300', '0', '4', 'اضافة فاتورة مبيعات', '1313', '1306935', '2026-10-22 13:54:43', '6',  'sellbillController.php','1','','0'); -- id=1619
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21300', '21300', '2026-10-22', '6', '0', '0', '2026-10-22 13:54:43','اضافة فاتورة مبيعات رقم 1313','1','0',null,'0','1313','sellbillController.php?do=showDetail&sellbillid=1313'); -- id=4533
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4533', '568', '21300', '','0'); -- id=4661
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1306935', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4533', '143', '21300', '','0'); -- id=4535
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15048290', 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 ( '19200', '19200', '2026-10-22', '6', '0', '0', '2026-10-22 13:54:43','اضافة فاتورة مبيعات رقم 1313 - صرف البضاعة من المخزن','1','0',null,'0','1313','sellbillController.php?do=showDetail&sellbillid=1313'); -- id=4534
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4534', '402', '19200', '','0'); -- id=4662
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13923803.61', 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 ('4534', '382', '19200', '','0'); -- id=4536
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26403800.59', 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='4533,0,4534' where sellbillid=1313;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21300, sellCostBuyPrice =sellCostBuyPrice+19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21300, sellCostBuyPrice =sellCostBuyPrice+19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200, 19200, 19200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21300, netSellCostBuyPrice = netSellCostBuyPrice+19200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+19200
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+19200
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+19200
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+19200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+19200;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e6d965f65 and sellbillId = 1313 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:24:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:54:44", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:54:44', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18376
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:25:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:55:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:55:40', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18377
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 ('06ad9eb3f8e2da', '2026-10-22 13:53:51', '74', '492190.00', '675790', '0', '0', '183600.00',  '183600.00', '0', '183600', '1', '2026-10-22 13:55:40', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=337
INSERT INTO buybilldetail (Parcode, buybillid, buybilldetailcatid, buybilldetailproductid, buybilldetailquantity, buybilldetailprice, buybilldetailtotalprice, discountvalue, note, buybilldetaildate, productunitid,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,quantitybefore, buybilldetailpriceC, buybilldetailtotalpriceC, discountvalueC,discounttype,rowtaxval,rowtaxper,lastbuyprice_withTax,meanbuyprice_withTax,probuyDiscountPer,lastbuyprice_withDiscountAndTax,storeid) VALUES ('01324', '337', '86', '1324', '510', '360', '183600.00', '0', '', '2026-10-22 13:55:40', '1324','','','0','0','0','0','0',null,'360','183600','0','0','0','0','0','0','0','0','1'); -- id=1801
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:53:51', 1, 1324, 0, 0
                    , 360, 510, 0, 0, 5, '2026-10-22 13:55:40')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+510, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 13:55:40' ; -- id=7127
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1324', '360', '510', '0', 'buyBillController.php', '1801', '', '0', '0'); -- id=1347
UPDATE product SET  productBuyPrice = "360" WHERE productId = 1324 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1801 ;
UPDATE product SET productName = 'موديل ايطالي العوضي', productDescription = '', productCatId = '86', productBuyPrice = '360.00', productSellAllPrice = '390.00', productSellUnitPrice = '390.00', productSellHalfPrice = '390.00', productDate = '2026-09-30', conditions = '0', userId = '1', limitamount = '0', parcode = '01324',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '357.16',meanbuyprice_withDiscount = '357.16' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.43' , buyhalf_precentage = '11.43' , buypart_precentage = '11.43',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355.2',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='357.16',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1324';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 357.16, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 357.16
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 357.16, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 1801;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 1324;
UPDATE storedetail SET  productquantity = '510', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '1324';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '1', '510', '0', '337', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '510', '5', '2026-10-22 13:53:51','0','0'); -- id=16860
UPDATE supplier SET  suppliercurrentDebt = '675790',suppliercurrentDebtInCurrency= '675790' , userid = '5', supplierdate = '2026-10-22 13:55:40'   WHERE supplierid = '74';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('74', '492190.00', '183600', '0', 'اضافة فاتورة مشتريات', '337', '675790', '2026-10-22 13:53:51', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','183600','1','492190','183600','675790','0',''); -- id=886
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '183600', '183600', '2026-10-22', '5', '0', '0', '2026-10-22 13:55:40','اضافة فاتورة مشتريات رقم 337','1','0',null,'0','337','buyBillController.php?do=details&id=337'); -- id=4535
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4535', '382', '183600', '','0'); -- id=4663
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26587400.59', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4535', '494', '183600', '','0'); -- id=4537
UPDATE accountstree SET name = 'محمد العوضي تريكو', customName = 'محمد العوضي تريكو', customNameEn = 'محمد العوضي تريكو', nameEn = 'محمد العوضي تريكو', parent = '81', accountNature = '1', theValue = '675790', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 10:33:20' WHERE id = '494';
update buybill set dailyentryid='4535,0' where buybillid=337;
COMMIT;
UPDATE product SET overAllAveragePrice = 356.33 WHERE productId = 1324;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:25:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:55:40", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:55:40', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=337'); -- id=18378
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:25:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:55:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:55:44', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=337&type=2'); -- id=18379
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:26:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:56:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:56:18', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1312'); -- id=18380
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:26:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:56:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:56:18', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1312'); -- id=18381
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:26:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:56:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:56:41', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18382
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('جاكت 550 احمد شحاتة','','214','550','650','0','0','2026-10-22','0','7','0','','0','0','0','0','0','550','550','550','550','550','0','18.18','0','0','.','0','0','0','550','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','550','550','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','550','0','0','0','0','0','0','','','0','0','0','0'); -- id=2445
UPDATE product SET productName = 'جاكت 550 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '550', productSellAllPrice = '650', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02445',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '18.18' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2445';
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', '2445', '1.00', '2026-10-22', '7', '0','0244501','650','0','0','550','','0','0','0','0','0','0','0','0','0','0'); -- id=2445
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2445', '1', '0', '7', '2026-10-22'); -- id=3840
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2445', '1', '0', '0', '2445', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16861
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2445, 1,'2026-10-22 13:56:41',7)
                ON DUPLICATE KEY UPDATE productid = 2445, edited = 1, sysdate = '2026-10-22 13:56:41', userid = 7; -- id=3642
UPDATE product SET productName = 'جاكت 550 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '550.00', productSellAllPrice = '650.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02445',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550' , buypricereal_precentage = '0' , buytotal_precentage = '18.18' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2445';
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 ('موديلات فرو 850 احمد شحاتة','','214','850','850','0','0','2026-10-22','0','7','0','','0','0','0','0','0','850','850','850','850','850','0','0','0','0','.','0','0','0','850','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','850','850','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','850','0','0','0','0','0','0','','','0','0','0','0'); -- id=2446
UPDATE product SET productName = 'موديلات فرو 850 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '850', productSellAllPrice = '850', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02446',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2446';
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', '2446', '1.00', '2026-10-22', '7', '0','0244601','850','0','0','850','','0','0','0','0','0','0','0','0','0','0'); -- id=2446
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2446', '1', '0', '7', '2026-10-22'); -- id=3841
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2446', '1', '0', '0', '2446', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16862
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2446, 1,'2026-10-22 13:56:41',7)
                ON DUPLICATE KEY UPDATE productid = 2446, edited = 1, sysdate = '2026-10-22 13:56:41', userid = 7; -- id=3643
UPDATE product SET productName = 'موديلات فرو 850 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '850.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02446',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2446';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:26:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:56:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:56:43', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18383
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:26:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:56:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:56:48', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18384
INSERT INTO supplier (suppliername, supplieraddress, supplierphone, suppliercurrentDebt, supplierdetails, conditions, userid, supplierdate, dailyentryid, category_id, typesupplier_id,linkedClientId,inUse,suppliercode,goverareaid,namepayeecheck,suppliermobile,warrantyOfficer,warrantymobile,sellername,sellermobile,taxnumber,supplierTypeForTree,treeId,sullpierCurrencyid,suppliercurrentDebtInCurrency,webApiId,shippingDiscountPer) VALUES ('احمد شحاتة', '', '', '', '', '0', '7', '2026-10-22 13:57:06', '0', '', '','0','0','','','','','','','','','','0','0','1','0','0','0'); -- id=207
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 ('207', '0', '', '0', 'إضافة مورد جديد', '207', '', '2026-10-22 13:57:06', '7', 'supplierController.php', '', '0','', '0','1','1','0','1','0','0','0','0',''); -- id=887
INSERT INTO accountstree (name, customName, customNameEn, nameEn, parent, accountNature, theValue, theOrder, layingOrder, reportid, listId, notes, itemfrom, itemtype, itemtype2, itemtype3, userid, del, sysdate) VALUES ('احمد شحاتة', 'احمد شحاتة', 'احمد شحاتة', 'احمد شحاتة', '81', '1', '0', '0', '', '1', '1', '', '0', '1', '1', '', '7', '0', '2026-10-22 13:57:06'); -- id=694
UPDATE supplier SET suppliername = 'احمد شحاتة', supplieraddress = '', supplierphone = '', suppliercurrentDebt = '0.00', supplierdetails = '', conditions = '0', userid = '7', supplierdate = '2026-10-22', dailyentryid = '0', category_id = '', typesupplier_id = '',linkedClientId = '0',inUse='0',suppliercode = '',goverareaid='',namepayeecheck = '',suppliermobile='',warrantyOfficer = '',warrantymobile='',sellername = '',sellermobile='',taxnumber = '',supplierTypeForTree='0',treeId='694',sullpierCurrencyid='1',suppliercurrentDebtInCurrency='0',webApiId='0',shippingDiscountPer='0' WHERE supplierid = '207';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:27:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:57:16", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:57:16', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18385
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:27:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:57:17", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:57:17', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18386
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:27:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:57:27", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:57:27', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18387

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9eb1702315
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:57:27', '06ad9eb1702315', '1', '0.00', '0', '0', '1', '10140.00', '10140', '10140', '0', '1', '2026-10-22 13:57:27', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '24' ,'0','','','','','-1','0','0','0','0','0','10140','0','','0','0','10140','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1314
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1314', '0', '2026-10-22 13:57:27', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10140', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:57:27','0','0','',''); -- id=1546
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6138;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02087', '1314', '174', '2087', '3', '430', '1290', '0', '', '0', '2026-10-22 13:57:27', '2087', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6138-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=5284
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5284;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2087, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '106', userid = '3', storedetaildate = '2026-10-22 13:57:27' WHERE storedetailid = '3446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2087', '1', '3', '1', '1314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '109', '106', '3', '2026-10-22 13:57:27','0','0'); -- id=16863
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','02250', '1314', '196', '2250', '9', '450', '4050', '0', '', '0', '2026-10-22 13:57:27', '2250', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6683-9,','1','1','0','0','450','4050','0','','0','0.00','0','0','0','0'); -- id=5285
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 427.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 5285;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2250, '2026-10-22', 4050, 4050, 4050
                    , 4050, 3645, 3847.5, 3645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4050, 2025, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3847.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2025
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4050, 4050, 4050
                    , 4050, 3645, 3847.5, 3645
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4050, 2025, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4050, sellCostBuyPrice =sellCostBuyPrice+4050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3645, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3847.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3645
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2025
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '3', storedetaildate = '2026-10-22 13:57:27' WHERE storedetailid = '3641';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2250', '1', '9', '1', '1314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '3', '3', '2026-10-22 13:57:27','0','0'); -- id=16864
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6138;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02087', '1314', '174', '2087', '6', '430', '2580', '0', '', '0', '2026-10-22 13:57:27', '2087', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6138-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=5286
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5286;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2087, '2026-10-22', 2580, 2580, 2580
                    , 2580, 2322, 2322, 2322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2580, 2580, 2580
                    , 2580, 2322, 2322, 2322
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2580, 2580, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2580
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2580, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2580
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2322, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2322
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2322
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2580
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2580
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '100', userid = '3', storedetaildate = '2026-10-22 13:57:27' WHERE storedetailid = '3446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2087', '1', '6', '1', '1314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '106', '100', '3', '2026-10-22 13:57:27','0','0'); -- id=16865
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 1118;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01931', '1314', '155', '1931', '6', '370', '2220', '0', '', '0', '2026-10-22 13:57:27', '1931', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1118-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=5287
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 1795, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 5287;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1931, '2026-10-22', 2220, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 10770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2220, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 10770, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10770
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '84', userid = '3', storedetaildate = '2026-10-22 13:57:27' WHERE storedetailid = '2948';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1931', '1', '6', '1', '1314', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '84', '3', '2026-10-22 13:57:27','0','0'); -- id=16866
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8519816',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8509676','10140', '0', '2', 'اضافة فاتورة مبيعات', '1314', '8519816', '2026-10-22 13:57:27', '3',  'sellbillController.php','1','','0'); -- id=1620
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10140', '10140', '2026-10-22', '3', '0', '0', '2026-10-22 13:57:27','اضافة فاتورة مبيعات رقم 1314','1','0',null,'0','1314','sellbillController.php?do=showDetail&sellbillid=1314'); -- id=4536
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4536', '419', '10140', '','0'); -- id=4664
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8519815.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4536', '143', '10140', '','0'); -- id=4538
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15058430', 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 ( '9228', '9228', '2026-10-22', '3', '0', '0', '2026-10-22 13:57:27','اضافة فاتورة مبيعات رقم 1314 - صرف البضاعة من المخزن','1','0',null,'0','1314','sellbillController.php?do=showDetail&sellbillid=1314'); -- id=4537
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4537', '402', '9228', '','0'); -- id=4665
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13933031.61', 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 ('4537', '382', '9228', '','0'); -- id=4539
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26578172.59', 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='4536,0,4537' where sellbillid=1314;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10140, 10020, 10020
                    , 10020, 9228, 9430.5, 9228
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10020, 16665, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10140, sellCostBuyPrice =sellCostBuyPrice+10020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9228, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9430.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9228
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16665
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10140, 10020, 10020
                    , 10020, 9228, 9430.5, 9228
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10020, 16665, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10140, sellCostBuyPrice =sellCostBuyPrice+10020
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10020, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10020
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9228, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9430.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9228
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10020
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16665
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10140, 10020, 10020
                    , 10020, 9228, 9430.5, 9228, 10020, 16665)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10140, netSellCostBuyPrice = netSellCostBuyPrice+10020
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10020
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10020
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9228
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9430.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9228
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10020
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+16665;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9eb1702315 and sellbillId = 1314 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:27:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:57:27", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 13:57:27', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18388
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:28:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:58:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:58:18', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=337&type=2'); -- id=18389
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:28:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:58:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:58:19', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=337'); -- id=18390
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:28:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:58:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:58:21', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18391
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:28:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:58:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:58:25', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18392
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:28:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:58:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:58:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18393
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:59:23', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18394
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:34", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:59:34', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18395
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:37", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 13:59:37', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18396
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:39", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 13:59:39', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18397
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:59:46', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18398
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:59:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18399
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:29:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 13:59:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 13:59:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18400
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:30:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:00:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:00:02', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18401
UPDATE productunit SET proUnitBuyPrice  = 750.00 * productnumber WHERE productid = 2446;
UPDATE product SET productName = 'موديلات فرو 850 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02446',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850.00',lastbuyprice_withDiscount = '850',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '850.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='850',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='800',meanbuyprice_withTax='800',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2446';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2446, 1,'2026-10-22 14:00:13',7)
                ON DUPLICATE KEY UPDATE productid = 2446, edited = 1, sysdate = '2026-10-22 14:00:13', userid = 7; -- id=3643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:31:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:01:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:01:06', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18402
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 ('06ad9ebf0407e1', '2026-10-22 13:56:48', '207', '0.00', '132300', '0', '0', '132300.00',  '132300.00', '0', '132300', '1', '2026-10-22 14:01:06', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=338
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 ('02445', '338', '214', '2445', '36', '550', '19800.00', '0', '', '2026-10-22 14:01:06', '2445','','','0','0','0','0','0',null,'550','19800','0','0','0','0','0','0','0','0','1'); -- id=1802
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:56:48', 1, 2445, 0, 0
                    , 550, 36, 0, 0, 7, '2026-10-22 14:01:06')
                ON DUPLICATE KEY UPDATE buyprice = 550,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:01:06' ; -- id=7128
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2445', '550', '36', '0', 'buyBillController.php', '1802', '', '0', '0'); -- id=1348
UPDATE product SET  productBuyPrice = "550" WHERE productId = 2445 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1802 ;
UPDATE product SET productName = 'جاكت 550 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '550.00', productSellAllPrice = '650.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02445',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '18.18' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2445';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 550, meanbuyprice_withDiscount = 550
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 550
                where buybilldetailid = 1802;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 2445;
UPDATE storedetail SET  productquantity = '36', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3840';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2445', '1', '36', '0', '338', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '7', '2026-10-22 13:56:48','0','0'); -- id=16867
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 ('02446', '338', '214', '2446', '21', '750', '15750.00', '0', '', '2026-10-22 14:01:06', '2446','','','0','0','0','0','0',null,'750','15750','0','0','0','0','0','0','0','0','1'); -- id=1803
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:56:48', 1, 2446, 0, 0
                    , 750, 21, 0, 0, 7, '2026-10-22 14:01:06')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+21, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:01:06' ; -- id=7129
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2446', '750', '21', '0', 'buyBillController.php', '1803', '', '0', '0'); -- id=1349
UPDATE product SET  productBuyPrice = "750" WHERE productId = 2446 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1803 ;
UPDATE product SET productName = 'موديلات فرو 850 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02446',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '750',meanbuyprice_withDiscount = '750' , productbuypricereal = '850.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='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='750',meanbuyprice_withTax='750',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2446';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 750, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 750
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 1803;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 2446;
UPDATE storedetail SET  productquantity = '21', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3841';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2446', '1', '21', '0', '338', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '21', '7', '2026-10-22 13:56:48','0','0'); -- id=16868
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 ('02446', '338', '214', '2446', '129', '750', '96750', '0', '', '2026-10-22 14:01:06', '2446','','','0','0','0','0','0',null,'750','96750','0','0','0','0','0','0','0','0','1'); -- id=1804
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 13:56:48', 1, 2446, 0, 0
                    , 750, 129, 0, 0, 7, '2026-10-22 14:01:06')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+129, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:01:06' ; -- id=7129
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2446', '750', '129', '0', 'buyBillController.php', '1804', '', '0', '0'); -- id=1350
UPDATE product SET  productBuyPrice = "750" WHERE productId = 2446 ;
UPDATE buybilldetail SET  quantitybefore = 21 WHERE buybilldetailid = 1804 ;
UPDATE product SET productName = 'موديلات فرو 850 احمد شحاتة', productDescription = '', productCatId = '214', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02446',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '750',meanbuyprice_withDiscount = '750' , productbuypricereal = '850.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='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='750',meanbuyprice_withTax='750',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2446';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 750, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 750
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 1804;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 2446;
UPDATE storedetail SET  productquantity = '150', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3841';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2446', '1', '129', '0', '338', 'اضافة فاتورة مشتريات', 'buyBillController.php', '21', '150', '7', '2026-10-22 13:56:48','0','0'); -- id=16869
UPDATE supplier SET  suppliercurrentDebt = '132300',suppliercurrentDebtInCurrency= '132300' , userid = '7', supplierdate = '2026-10-22 14:01:06'   WHERE supplierid = '207';
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 ('207', '0.00', '132300', '0', 'اضافة فاتورة مشتريات', '338', '132300', '2026-10-22 13:56:48', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','132300','1','0','132300','132300','0',''); -- id=888
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '132300', '132300', '2026-10-22', '7', '0', '0', '2026-10-22 14:01:06','اضافة فاتورة مشتريات رقم 338','1','0',null,'0','338','buyBillController.php?do=details&id=338'); -- id=4538
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4538', '382', '132300', '','0'); -- id=4666
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26710472.59', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4538', '694', '132300', '','0'); -- id=4540
UPDATE accountstree SET name = 'احمد شحاتة', customName = 'احمد شحاتة', customNameEn = 'احمد شحاتة', nameEn = 'احمد شحاتة', parent = '81', accountNature = '1', theValue = '132300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 13:57:06' WHERE id = '694';
update buybill set dailyentryid='4538,0' where buybillid=338;
COMMIT;
UPDATE product SET overAllAveragePrice = 550 WHERE productId = 2445;UPDATE product SET overAllAveragePrice = 750 WHERE productId = 2446;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:31:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:01:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:01:06', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=338'); -- id=18403
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:31:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:01:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:01:10', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=338&type=2'); -- id=18404
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:35:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:05:44", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:05:44', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18405

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ec17b6857
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ec17b6857 and sellbillId = 1315 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:35:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:05:45", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:05:45', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18406
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:37:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:07:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:07:54', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18407

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9eb138534d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 14:07:54', '06ad9eb138534d', '1', '0.00', '0', '0', '1', '14240.00', '14240', '14240', '0', '1', '2026-10-22 14:07:54', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '25' ,'0','','','','','-1','0','0','0','0','0','14240','0','','0','0','14240','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1316
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1316', '0', '2026-10-22 14:07:54', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '14240', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 14:07:54','0','0','',''); -- id=1548
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 1124;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('617','01936', '1316', '8', '1936', '4', '645', '2580', '0', '', '0', '2026-10-22 14:07:54', '1936', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1124-4,','1','1','0','0','645','2580','0','','0','0.00','0','0','0','0'); -- id=5289
UPDATE sellbilldetail SET  lastbuyprice = 617.00 , meanbuyprice = 617.00, lastbuyprice_withDiscount = 617.00, meanbuyprice_withDiscount = 617.00
        , lastbuyprice_withTax = 617, meanbuyprice_withTax = 617, lastbuyprice_withDiscountAndTax = 617
                where sellbilldetailid = 5289;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1936, '2026-10-22', 2580, 2468, 2468
                    , 2468, 2468, 2468, 2468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2468, 2468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2580, 2468, 2468
                    , 2468, 2468, 2468, 2468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2468, 2468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2580, sellCostBuyPrice =sellCostBuyPrice+2468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '1', userid = '2', storedetaildate = '2026-10-22 14:07:54' WHERE storedetailid = '2953';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1936', '1', '4', '1', '1316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5', '1', '2', '2026-10-22 14:07:54','0','0'); -- id=16871
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','09714', '1316', '11', '770', '5', '455', '2275', '0', '', '0', '2026-10-22 14:07:54', '770', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','455','2275','0','','0','0.00','0','0','0','0'); -- id=5290
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5290;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (770, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2275, 2175, 2175
                    , 2175, 2175, 2175, 2175
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2175, 2175, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2275, sellCostBuyPrice =sellCostBuyPrice+2175
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2175, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2175
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2175, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2175
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2175
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2175
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2175
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '254', userid = '2', storedetaildate = '2026-10-22 14:07:54' WHERE storedetailid = '770';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('770', '1', '5', '1', '1316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '259', '254', '2', '2026-10-22 14:07:54','0','0'); -- id=16872
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6874;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('657','02320', '1316', '8', '2320', '5', '685', '3425', '0', '', '0', '2026-10-22 14:07:54', '2320', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6874-5,','1','1','0','0','685','3425','0','','0','0.00','0','0','0','0'); -- id=5291
UPDATE sellbilldetail SET  lastbuyprice = 657.00 , meanbuyprice = 657.00, lastbuyprice_withDiscount = 657.00, meanbuyprice_withDiscount = 657.00
        , lastbuyprice_withTax = 657, meanbuyprice_withTax = 657, lastbuyprice_withDiscountAndTax = 657
                where sellbilldetailid = 5291;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2320, '2026-10-22', 3425, 3285, 3285
                    , 3285, 3285, 3285, 3285
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 3285, 3285, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3425, sellCostBuyPrice =sellCostBuyPrice+3285
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3285, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3285
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3285, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3285
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3285
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3285
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3285
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3425, 3285, 3285
                    , 3285, 3285, 3285, 3285
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3285, 3285, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3425, sellCostBuyPrice =sellCostBuyPrice+3285
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3285, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3285
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3285, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3285
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3285
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3285
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3285
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2026-10-22 14:07:54' WHERE storedetailid = '3714';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2320', '1', '5', '1', '1316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '5', '2', '2026-10-22 14:07:54','0','0'); -- id=16873
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 69;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('530','01354', '1316', '26', '1354', '5', '550', '2750', '0', '', '0', '2026-10-22 14:07:54', '1354', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','69-5,','1','1','0','0','550','2750','0','','0','0.00','0','0','0','0'); -- id=5292
UPDATE sellbilldetail SET  lastbuyprice = 530.00 , meanbuyprice = 530.00, lastbuyprice_withDiscount = 530.00, meanbuyprice_withDiscount = 530.00
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where sellbilldetailid = 5292;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1354, '2026-10-22', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2750, 2650, 2650
                    , 2650, 2650, 2650, 2650
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2650, 2650, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2750, sellCostBuyPrice =sellCostBuyPrice+2650
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2650, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2650
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2650, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2650
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2650
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2650
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2650
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 14:07:54' WHERE storedetailid = '1354';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1354', '1', '5', '1', '1316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '35', '30', '2', '2026-10-22 14:07:54','0','0'); -- id=16874
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6086;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('510','02054', '1316', '19', '2054', '6', '535', '3210', '0', '', '0', '2026-10-22 14:07:54', '2054', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6086-6,','1','1','0','0','535','3210','0','','0','0.00','0','0','0','0'); -- id=5293
UPDATE sellbilldetail SET  lastbuyprice = 510.00 , meanbuyprice = 510.00, lastbuyprice_withDiscount = 510.00, meanbuyprice_withDiscount = 510.00
        , lastbuyprice_withTax = 510, meanbuyprice_withTax = 510, lastbuyprice_withDiscountAndTax = 510
                where sellbilldetailid = 5293;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2054, '2026-10-22', 3210, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3210, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3210, 3060, 3060
                    , 3060, 3060, 3060, 3060
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3060, 3060, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3210, sellCostBuyPrice =sellCostBuyPrice+3060
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3060, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3060
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3060, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3060
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3060
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3060
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3060
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 14:07:54' WHERE storedetailid = '3413';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2054', '1', '6', '1', '1316', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 14:07:54','0','0'); -- id=16875
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8535511',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8521271','14240', '0', '2', 'اضافة فاتورة مبيعات', '1316', '8535511', '2026-10-22 14:07:54', '2',  'sellbillController.php','1','','0'); -- id=1622
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '14240', '14240', '2026-10-22', '2', '0', '0', '2026-10-22 14:07:54','اضافة فاتورة مبيعات رقم 1316','1','0',null,'0','1316','sellbillController.php?do=showDetail&sellbillid=1316'); -- id=4541
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4541', '419', '14240', '','0'); -- id=4669
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8535510.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4541', '143', '14240', '','0'); -- id=4543
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15074125', 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 ( '13638', '13638', '2026-10-22', '2', '0', '0', '2026-10-22 14:07:54','اضافة فاتورة مبيعات رقم 1316 - صرف البضاعة من المخزن','1','0',null,'0','1316','sellbillController.php?do=showDetail&sellbillid=1316'); -- id=4542
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4542', '402', '13638', '','0'); -- id=4670
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13948049.61', 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 ('4542', '382', '13638', '','0'); -- id=4544
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26695454.59', 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='4541,0,4542' where sellbillid=1316;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 14240, 13638, 13638
                    , 13638, 13638, 13638, 13638
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13638, 13638, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14240, sellCostBuyPrice =sellCostBuyPrice+13638
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13638, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13638
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13638, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13638
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13638
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13638
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13638
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 14240, 13638, 13638
                    , 13638, 13638, 13638, 13638
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,13638, 13638, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+14240, sellCostBuyPrice =sellCostBuyPrice+13638
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+13638, sellCostMeanBuyPrice = sellCostMeanBuyPrice+13638
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+13638, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13638
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+13638
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+13638
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+13638
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 14240, 13638, 13638
                    , 13638, 13638, 13638, 13638, 13638, 13638)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+14240, netSellCostBuyPrice = netSellCostBuyPrice+13638
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+13638
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+13638
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+13638
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13638
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+13638
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+13638
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+13638;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9eb138534d and sellbillId = 1316 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:37:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:07:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:07:54', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18408
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:38:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:08:43", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:08:43', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18409

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ee0947d64
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ee0947d64 and sellbillId = 1317 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:38:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:08:43", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:08:43', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18410
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:39:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:09:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:09:17', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18411

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9ee8a63533
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9ee8a63533 and sellbillId = 1318 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:39:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:09:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:09:17', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18412
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:40:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:10:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:10:41', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18413
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:40:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:10:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:10:41', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18414
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:40:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:10:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:10:55', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18415
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:41:24";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:43:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:13:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:13:51', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18416

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9eebb8601f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9eebb8601f and sellbillId = 1319 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:43:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:13:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:13:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18417
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:40";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:14:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:14:41', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18418

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9eedd8bec9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9eedd8bec9 and sellbillId = 1320 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:14:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:14:41', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18419
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:14:45", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 14:14:45', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18420
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:46";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 14:14:46', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18421
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:44:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:14:55", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 14:14:55', '1', 'invReport', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=invReport'); -- id=18422
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:45:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:15:53", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 14:15:53', '1', 'invReport', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=invReport'); -- id=18423
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:48:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:18:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:18:06', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18424

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9efefbd396
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9efefbd396 and sellbillId = 1321 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:48:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:18:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:18:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18425
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:51:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:21:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:21:47', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18426
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:51:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:21:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:21:47', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18427
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:51:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:21:51", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:21:51', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18428
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:51:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:21:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:21:52', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18429
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:55:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:25:11", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:25:11', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18430
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:55:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:25:11", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:25:11', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18431
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:56:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:26:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:26:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18432
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:56:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:26:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:26:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18433
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:58:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:28:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:28:46', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18434

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f2f76295d
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f2f76295d and sellbillId = 1322 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 10:58:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:28:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:28:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18435
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:00:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:30:37", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:30:37', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18436

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9eb58ac2e0
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9eb58ac2e0 and sellbillId = 1323 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:00:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:30:38", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:30:38', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18437
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:04:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:34:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 14:34:00', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18438
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:04:00";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 14:34:00', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18439
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:04:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:34:06", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:34:06', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18440
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:05:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:35:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:35:37', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18441

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9e80bb40f1
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 14:35:37', '06ad9e80bb40f1', '1', '0.00', '0', '20', '1', '10020.00', '10000', '10000', '0', '2', '2026-10-22 14:35:37', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '25' ,'0','','','','','-1','0','0','0','0','0','10000','0','','0','0','10000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1324
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1324', '0', '2026-10-22 14:35:37', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 14:35:37','0','0','',''); -- id=1556
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 493;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01550', '1324', '112', '1550', '6', '430', '2580', '0', '', '0', '2026-10-22 14:35:37', '1550', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','493-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=5304
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5304;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1550, '2026-10-22', 2574.8502994012, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2574.8502994012, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2574.8502994012, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2574.8502994012, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '4', storedetaildate = '2026-10-22 14:35:37' WHERE storedetailid = '2562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1550', '2', '6', '1', '1324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '60', '4', '2026-10-22 14:35:37','0','0'); -- id=16886
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 151;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','01358', '1324', '88', '1358', '3', '400', '1200', '0', '', '0', '2026-10-22 14:35:37', '1358', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','151-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5305
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 5305;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1358, '2026-10-22', 1197.6047904192, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1197.6047904192, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 1197.6047904192, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1140, 1140, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1197.6047904192, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1140
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '4', storedetaildate = '2026-10-22 14:35:37' WHERE storedetailid = '1415';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1358', '2', '3', '1', '1324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '8', '5', '4', '2026-10-22 14:35:37','0','0'); -- id=16887
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1324', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-22 14:35:37', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=5306
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 357.16, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 357.16
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 357.16, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5306;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 3113.7724550898, 2880, 2880
                    , 2857.28, 2880, 2857.28, 2850.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2857.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3113.7724550898, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2857.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2857.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2857.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3113.7724550898, 2880, 2880
                    , 2857.28, 2880, 2857.28, 2850.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2857.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3113.7724550898, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2857.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2857.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2857.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '941', userid = '4', storedetaildate = '2026-10-22 14:35:37' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '1324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '949', '941', '4', '2026-10-22 14:35:37','0','0'); -- id=16888
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1324', '86', '1324', '8', '390', '3120', '0', '', '0', '2026-10-22 14:35:37', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-8,','1','1','0','0','390','3120','0','','0','0.00','0','0','0','0'); -- id=5307
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 357.16, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 357.16
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 357.16, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5307;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 3113.7724550898, 2880, 2880
                    , 2857.28, 2880, 2857.28, 2850.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 2857.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3113.7724550898, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2857.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2857.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2857.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3113.7724550898, 2880, 2880
                    , 2857.28, 2880, 2857.28, 2850.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2857.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3113.7724550898, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2857.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2857.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2850.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2857.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '933', userid = '4', storedetaildate = '2026-10-22 14:35:37' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '8', '1', '1324', 'اضافة فاتورة مبيعات', 'sellbillController.php', '941', '933', '4', '2026-10-22 14:35:37','0','0'); -- id=16889
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1265802.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1255802.875','10000', '0', '3', 'اضافة فاتورة مبيعات', '1324', '1265802.875', '2026-10-22 14:35:37', '4',  'sellbillController.php','1','','0'); -- id=1630
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10020', '10020', '2026-10-22', '4', '0', '0', '2026-10-22 14:35:37','اضافة فاتورة مبيعات رقم 1324','1','0',null,'0','1324','sellbillController.php?do=showDetail&sellbillid=1324'); -- id=4557
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4557', '501', '10000', '','0'); -- id=4685
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1265802.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4557', '398', '20', '','0'); -- id=4686
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '511806.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4557', '143', '10020', '','0'); -- id=4559
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15117435', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9120', '9120', '2026-10-22', '4', '0', '0', '2026-10-22 14:35:37','اضافة فاتورة مبيعات رقم 1324 - صرف البضاعة من المخزن','1','0',null,'0','1324','sellbillController.php?do=showDetail&sellbillid=1324'); -- id=4558
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4558', '402', '9120', '','0'); -- id=4687
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13987709.11', 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 ('4558', '492', '9120', '','0'); -- id=4560
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1489076', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4557,0,4558' where sellbillid=1324;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10000, 9120, 9120
                    , 9074.56, 9120, 9074.56, 9061.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9074.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10000, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9074.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9074.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9061.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9074.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10000, 9120, 9120
                    , 9074.56, 9120, 9074.56, 9061.28
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9120, 9074.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10000, sellCostBuyPrice =sellCostBuyPrice+9120
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9120, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9074.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9120, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9074.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9061.28
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9120
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9074.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 10000, 9120, 9120
                    , 9074.56, 9120, 9074.56, 9061.28, 9120, 9074.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10000, netSellCostBuyPrice = netSellCostBuyPrice+9120
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9120
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9074.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9120
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9074.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9061.28
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9120
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9074.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9e80bb40f1 and sellbillId = 1324 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:05:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:35:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:35:37', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18442
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:08:36";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:08:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:38:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 14:38:41', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18443
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:08:41";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 14:38:41', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18444
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:08:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:38:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:38:43', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18445
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:09:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:39:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:39:55', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18446
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:10:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:40:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:40:01', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=338&type=2'); -- id=18447
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:10:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:40:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:40:02', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=338'); -- id=18448
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:10:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:40:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:40:18', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18449
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:41:02', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18450
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:41:18', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18451

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f3de1093e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 14:41:19', '06ad9f3de1093e', '1', '0.00', '0', '0', '1', '6555.00', '6555', '6555', '0', '1', '2026-10-22 14:41:19', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','6555','0','','0','0','6555','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1325
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1325', '0', '2026-10-22 14:41:19', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6555', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 14:41:19','0','0','',''); -- id=1557
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6707;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02252', '1325', '191', '2252', '3', '370', '1110', '0', '', '0', '2026-10-22 14:41:19', '2252', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6707-3,','1','1','0','0','370','1110','0','','0','0.00','0','0','0','0'); -- id=5308
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5308;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2252, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '89', userid = '6', storedetaildate = '2026-10-22 14:41:19' WHERE storedetailid = '3643';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2252', '1', '3', '1', '1325', 'اضافة فاتورة مبيعات', 'sellbillController.php', '92', '89', '6', '2026-10-22 14:41:19','0','0'); -- id=16890
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6479;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('280','02203', '1325', '191', '2203', '3', '345', '1035', '0', '', '0', '2026-10-22 14:41:19', '2203', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6479-3,','1','1','0','0','345','1035','0','','0','0.00','0','0','0','0'); -- id=5309
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
        , lastbuyprice_withTax = 280, meanbuyprice_withTax = 280, lastbuyprice_withDiscountAndTax = 280
                where sellbilldetailid = 5309;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2203, '2026-10-22', 1035, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1035, 840, 840
                    , 840, 840, 840, 840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 840, 840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1035, sellCostBuyPrice =sellCostBuyPrice+840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '6', storedetaildate = '2026-10-22 14:41:19' WHERE storedetailid = '3592';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2203', '1', '3', '1', '1325', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '6', '2026-10-22 14:41:19','0','0'); -- id=16891
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6002;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('390','02021', '1325', '91', '2021', '9', '490', '4410', '0', '', '0', '2026-10-22 14:41:19', '2021', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6002-9,','1','1','0','0','490','4410','0','','0','0.00','0','0','0','0'); -- id=5310
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 390
                where sellbilldetailid = 5310;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2021, '2026-10-22', 4410, 3510, 3510
                    , 3510, 3510, 3510, 3510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4410, 3510, 3510
                    , 3510, 3510, 3510, 3510
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3510, 3510, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4410, sellCostBuyPrice =sellCostBuyPrice+3510
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3510, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3510
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3510, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3510
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3510
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3510
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3510
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '204', userid = '6', storedetaildate = '2026-10-22 14:41:19' WHERE storedetailid = '3380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2021', '1', '9', '1', '1325', 'اضافة فاتورة مبيعات', 'sellbillController.php', '213', '204', '6', '2026-10-22 14:41:19','0','0'); -- id=16892
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1317720',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1311165','6555', '0', '4', 'اضافة فاتورة مبيعات', '1325', '1317720', '2026-10-22 14:41:19', '6',  'sellbillController.php','1','','0'); -- id=1631
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6555', '6555', '2026-10-22', '6', '0', '0', '2026-10-22 14:41:19','اضافة فاتورة مبيعات رقم 1325','1','0',null,'0','1325','sellbillController.php?do=showDetail&sellbillid=1325'); -- id=4559
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4559', '568', '6555', '','0'); -- id=4688
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1317720', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4559', '143', '6555', '','0'); -- id=4561
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15123990', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '5250', '5250', '2026-10-22', '6', '0', '0', '2026-10-22 14:41:19','اضافة فاتورة مبيعات رقم 1325 - صرف البضاعة من المخزن','1','0',null,'0','1325','sellbillController.php?do=showDetail&sellbillid=1325'); -- id=4560
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4560', '402', '5250', '','0'); -- id=4689
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '13992959.11', 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 ('4560', '382', '5250', '','0'); -- id=4562
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26659665.09', 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='4559,0,4560' where sellbillid=1325;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6555, 5250, 5250
                    , 5250, 5250, 5250, 5250
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5250, 5250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6555, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6555, 5250, 5250
                    , 5250, 5250, 5250, 5250
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,5250, 5250, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6555, sellCostBuyPrice =sellCostBuyPrice+5250
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5250, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5250
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5250, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5250
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5250
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5250
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5250
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 6555, 5250, 5250
                    , 5250, 5250, 5250, 5250, 5250, 5250)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6555, netSellCostBuyPrice = netSellCostBuyPrice+5250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+5250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+5250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+5250
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+5250
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+5250
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+5250
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+5250;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f3de1093e and sellbillId = 1325 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:41:19', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18452
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 ('06ad9f6223afeb', '2026-10-22 14:40:18', '17', '66088.00', '108613', '10', '1', '47250.00',  '42525.00', '0', '42525', '1', '2026-10-22 14:41:19', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=339
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 ('02040', '339', '54', '2040', '105', '450', '47250.00', '0', '', '2026-10-22 14:41:19', '2040','','','0','0','0','0','0',null,'450','47250','0','0','0','0','0','0','0','0','1'); -- id=1805
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:40:18', 1, 2040, 0, 0
                    , 405, 105, 0, 0, 5, '2026-10-22 14:41:19')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+105, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 14:41:19' ; -- id=7131
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2040', '450', '105', '0', 'buyBillController.php', '1805', '', '0', '0'); -- id=1351
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2040 ;
UPDATE buybilldetail SET  quantitybefore = 42 WHERE buybilldetailid = 1805 ;
UPDATE product SET productName = 'جاكت المعلم', productDescription = '', productCatId = '54', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '02040',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2040';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1805;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2040;
UPDATE storedetail SET  productquantity = '147', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3399';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2040', '1', '105', '0', '339', 'اضافة فاتورة مشتريات', 'buyBillController.php', '42', '147', '5', '2026-10-22 14:40:18','0','0'); -- id=16893
UPDATE supplier SET  suppliercurrentDebt = '108613',suppliercurrentDebtInCurrency= '108613' , userid = '5', supplierdate = '2026-10-22 14:41:19'   WHERE supplierid = '17';
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 ('17', '66088.00', '42525', '0', 'اضافة فاتورة مشتريات', '339', '108613', '2026-10-22 14:40:18', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','42525','1','66088','42525','108613','0',''); -- id=889
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '42525', '42525', '2026-10-22', '5', '0', '0', '2026-10-22 14:41:19','اضافة فاتورة مشتريات رقم 339','1','0',null,'0','339','buyBillController.php?do=details&id=339'); -- id=4561
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4561', '382', '42525', '','0'); -- id=4690
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26702190.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4561', '436', '42525', '','0'); -- id=4563
UPDATE accountstree SET name = 'المعلم - مورد', customName = 'المعلم - مورد', customNameEn = 'المعلم - مورد', nameEn = 'المعلم - مورد', parent = '81', accountNature = '1', theValue = '96770', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '436';
update buybill set dailyentryid='4561,0' where buybillid=339;
COMMIT;
UPDATE product SET overAllAveragePrice = 405 WHERE productId = 2040;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:19", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:41:19', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18453
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:41:19', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=339'); -- id=18454
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:11:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:41:22", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:41:22', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=339&type=2'); -- id=18455
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:42:06', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18456
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:42:30', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18457

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f4aea215d
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f4aea215d and sellbillId = 1326 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:30", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:42:30', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18458
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:42:42', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18459
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:42:48', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=339&type=2'); -- id=18460
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:42:52', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18461
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:42:53', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=339'); -- id=18462
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:42:55', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18463
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:42:56', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18464
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:12:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:42:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:42:56', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18465
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:13:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:43:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:43:05', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18466
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:13:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:43:05", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:43:05', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18467
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:14:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:44:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:44:04', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18468

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f6c0b8966
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f6c0b8966 and sellbillId = 1327 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:14:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:44:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:44:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18469
UPDATE product SET productName = 'موديلات 335 الونش', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '335.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08584',type ='0', expireDate = '0' , dailyentryId = '129',isService = '0',isOptic = '0',lastbuyprice = '315.00',lastbuyprice_withDiscount = '315',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.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='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8584',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '774';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (774, 1,'2026-10-22 14:44:16',7)
                ON DUPLICATE KEY UPDATE productid = 774, edited = 1, sysdate = '2026-10-22 14:44:16', userid = 7; -- id=1419
UPDATE product SET productName = 'قطن مخربيش الونش', productDescription = '', productCatId = '13', productBuyPrice = '295.00', productSellAllPrice = '315.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08585',type ='0', expireDate = '0' , dailyentryId = '130',isService = '0',isOptic = '0',lastbuyprice = '295.00',lastbuyprice_withDiscount = '295',meanbuyprice = '295.00',meanbuyprice_withDiscount = '295' , productbuypricereal = '295.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='295',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8585',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='295',meanbuyprice_withTax='295',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='295',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '775';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (775, 1,'2026-10-22 14:44:20',7)
                ON DUPLICATE KEY UPDATE productid = 775, edited = 1, sysdate = '2026-10-22 14:44:20', userid = 7; -- id=1420
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:14:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:44:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:44:42', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18470
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:14:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:44:42", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:44:42', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18471
UPDATE product SET productName = 'موديلات 335 الونش', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '335.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08584',type ='0', expireDate = '0' , dailyentryId = '129',isService = '0',isOptic = '0',lastbuyprice = '315.00',lastbuyprice_withDiscount = '315',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.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='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8584',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '774';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (774, 1,'2026-10-22 14:44:43',7)
                ON DUPLICATE KEY UPDATE productid = 774, edited = 1, sysdate = '2026-10-22 14:44:43', userid = 7; -- id=1419
UPDATE product SET productName = 'موديلات 265 شبابي', productDescription = '', productCatId = '13', productBuyPrice = '245.00', productSellAllPrice = '265.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '60117',type ='0', expireDate = '0' , dailyentryId = '132',isService = '0',isOptic = '0',lastbuyprice = '245.00',lastbuyprice_withDiscount = '245',meanbuyprice = '245.00',meanbuyprice_withDiscount = '245' , productbuypricereal = '245.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='245',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='60117',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='245',meanbuyprice_withTax='245',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='245',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '777';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (777, 1,'2026-10-22 14:45:08',7)
                ON DUPLICATE KEY UPDATE productid = 777, edited = 1, sysdate = '2026-10-22 14:45:08', userid = 7; -- id=1422
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:15:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:45:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:45:20', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18472

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f509e9dcc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 14:45:20', '06ad9f509e9dcc', '1', '0.00', '0', '350', '1', '26350.00', '26000', '26000', '0', '2', '2026-10-22 14:45:20', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '65' ,'0','','','','','-1','0','0','0','0','0','26000','0','','0','0','26000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1328
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1328', '0', '2026-10-22 14:45:20', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '26000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 14:45:20','0','0','',''); -- id=1560
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6730;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01442', '1328', '88', '1442', '8', '440', '3520', '0', '', '0', '2026-10-22 14:45:20', '1442', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6730-8,','1','1','0','0','440','3520','0','','0','0.00','0','0','0','0'); -- id=5313
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5313;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1442, '2026-10-22', 3473.2447817837, 3280, 3280
                    , 3280, 3280, 3280, 3280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 3280, 3280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3473.2447817837, sellCostBuyPrice =sellCostBuyPrice+3280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 3473.2447817837, 3280, 3280
                    , 3280, 3280, 3280, 3280
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3280, 3280, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3473.2447817837, sellCostBuyPrice =sellCostBuyPrice+3280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3280
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3280
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '52', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '1473';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1442', '2', '8', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '52', '4', '2026-10-22 14:45:20','0','0'); -- id=16896
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '1328', '87', '1325', '6', '390', '2340', '0', '', '0', '2026-10-22 14:45:20', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5314
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 5314;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-22', 2308.9184060721, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2308.9184060721, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2308.9184060721, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2308.9184060721, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '154', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '6', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '160', '154', '4', '2026-10-22 14:45:20','0','0'); -- id=16897
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 133;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01325', '1328', '87', '1325', '6', '390', '2340', '0', '', '0', '2026-10-22 14:45:20', '1325', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','133-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5315
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where sellbilldetailid = 5315;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1325, '2026-10-22', 2308.9184060721, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2308.9184060721, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2308.9184060721, 2100, 2100
                    , 2100, 2100, 2100, 2100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2308.9184060721, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '148', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '1406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1325', '2', '6', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '154', '148', '4', '2026-10-22 14:45:20','0','0'); -- id=16898
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+33 where id = 131;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('350','01324', '1328', '86', '1324', '33', '390', '12870', '0', '', '0', '2026-10-22 14:45:20', '1324', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','131-33,','1','1','0','0','390','12870','0','','0','0.00','0','0','0','0'); -- id=5316
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 357.16, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 357.16
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 357.16, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5316;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1324, '2026-10-22', 12699.051233397, 11880, 11880
                    , 11786.28, 11880, 11786.28, 11758.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 33, 0, 11880, 11786.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12699.051233397, sellCostBuyPrice =sellCostBuyPrice+11880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11786.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11786.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11758.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11786.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+33
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 12699.051233397, 11880, 11880
                    , 11786.28, 11880, 11786.28, 11758.89
                    , 0, 0, 0, 0
                    , 0, 0, 0, 11880, 11786.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12699.051233397, sellCostBuyPrice =sellCostBuyPrice+11880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11786.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11786.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11758.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+11786.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '900', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '1405';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1324', '2', '33', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '933', '900', '4', '2026-10-22 14:45:20','0','0'); -- id=16899
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 493;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('370','01550', '1328', '112', '1550', '6', '430', '2580', '0', '', '0', '2026-10-22 14:45:20', '1550', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','493-6,','1','1','0','0','430','2580','0','','0','0.00','0','0','0','0'); -- id=5317
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where sellbilldetailid = 5317;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1550, '2026-10-22', 2545.7305502846, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2545.7305502846, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2545.7305502846, 2220, 2220
                    , 2220, 2220, 2220, 2220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2545.7305502846, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '2562';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1550', '2', '6', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '54', '4', '2026-10-22 14:45:20','0','0'); -- id=16900
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6467;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','02128', '1328', '182', '2128', '6', '450', '2700', '0', '', '0', '2026-10-22 14:45:20', '2128', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6467-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5318
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 5318;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2128, '2026-10-22', 2664.1366223909, 2700, 2700
                    , 2700, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2664.1366223909, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2664.1366223909, 2700, 2700
                    , 2700, 2430, 2430, 2430
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2664.1366223909, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2430, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2430
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2430
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '4', storedetaildate = '2026-10-22 14:45:20' WHERE storedetailid = '3586';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2128', '2', '6', '1', '1328', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '3', '4', '2026-10-22 14:45:20','0','0'); -- id=16901
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1291802.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1265802.875','26000', '0', '3', 'اضافة فاتورة مبيعات', '1328', '1291802.875', '2026-10-22 14:45:20', '4',  'sellbillController.php','1','','0'); -- id=1634
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '26350', '26350', '2026-10-22', '4', '0', '0', '2026-10-22 14:45:20','اضافة فاتورة مبيعات رقم 1328','1','0',null,'0','1328','sellbillController.php?do=showDetail&sellbillid=1328'); -- id=4566
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4566', '501', '26000', '','0'); -- id=4695
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1291802.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4566', '398', '350', '','0'); -- id=4696
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '512156.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4566', '143', '26350', '','0'); -- id=4568
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15157630', 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 ( '24010', '24010', '2026-10-22', '4', '0', '0', '2026-10-22 14:45:20','اضافة فاتورة مبيعات رقم 1328 - صرف البضاعة من المخزن','1','0',null,'0','1328','sellbillController.php?do=showDetail&sellbillid=1328'); -- id=4567
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4567', '402', '24010', '','0'); -- id=4697
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14023773.11', 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 ('4567', '492', '24010', '','0'); -- id=4569
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1465066', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4566,0,4567' where sellbillid=1328;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 26000, 24280, 24280
                    , 24186.28, 24010, 23916.28, 23888.89
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24280, 24186.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26000, sellCostBuyPrice =sellCostBuyPrice+24280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24186.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23916.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23888.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24186.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 26000, 24280, 24280
                    , 24186.28, 24010, 23916.28, 23888.89
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24280, 24186.28, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+26000, sellCostBuyPrice =sellCostBuyPrice+24280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24186.28
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+24010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23916.28
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23888.89
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24280
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24186.28
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 26000, 24280, 24280
                    , 24186.28, 24010, 23916.28, 23888.89, 24280, 24186.28)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+26000, netSellCostBuyPrice = netSellCostBuyPrice+24280
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+24280
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+24186.28
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+24010
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+23916.28
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+23888.89
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+24280
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+24186.28;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f509e9dcc and sellbillId = 1328 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:15:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:45:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:45:20', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18473
UPDATE productunit SET proUnitSellAllPrice  = 260.00 * productnumber  WHERE productid = 777;
UPDATE product SET productName = 'موديلات 265 شبابي', productDescription = '', productCatId = '13', productBuyPrice = '245.00', productSellAllPrice = '260.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '60117',type ='0', expireDate = '0' , dailyentryId = '132',isService = '0',isOptic = '0',lastbuyprice = '245.00',lastbuyprice_withDiscount = '245',meanbuyprice = '245.00',meanbuyprice_withDiscount = '245' , productbuypricereal = '245.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='245',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='60117',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='245',meanbuyprice_withTax='245',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='245',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '777';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (777, 1,'2026-10-22 14:45:28',7)
                ON DUPLICATE KEY UPDATE productid = 777, edited = 1, sysdate = '2026-10-22 14:45:28', userid = 7; -- id=1422
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:16:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:46:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:46:28', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18474
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:17:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:47:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:47:20', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18475
UPDATE product SET productName = 'موديلات 265 شبابي', productDescription = '', productCatId = '13', productBuyPrice = '245.00', productSellAllPrice = '260.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '60117',type ='0', expireDate = '0' , dailyentryId = '132',isService = '0',isOptic = '0',lastbuyprice = '245.00',lastbuyprice_withDiscount = '245',meanbuyprice = '245.00',meanbuyprice_withDiscount = '245' , productbuypricereal = '245.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='245',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='60117',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='245',meanbuyprice_withTax='245',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='245',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '777';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (777, 1,'2026-10-22 14:47:48',7)
                ON DUPLICATE KEY UPDATE productid = 777, edited = 1, sysdate = '2026-10-22 14:47:48', userid = 7; -- id=1422
UPDATE productunit SET proUnitSellAllPrice  = 330.00 * productnumber  WHERE productid = 774;
UPDATE product SET productName = 'موديلات 335 الونش', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08584',type ='0', expireDate = '0' , dailyentryId = '129',isService = '0',isOptic = '0',lastbuyprice = '315.00',lastbuyprice_withDiscount = '315',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.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='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8584',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '774';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (774, 1,'2026-10-22 14:47:56',7)
                ON DUPLICATE KEY UPDATE productid = 774, edited = 1, sysdate = '2026-10-22 14:47:56', userid = 7; -- id=1419
UPDATE product SET productName = 'موديلات 330 الونش', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08584',type ='0', expireDate = '0' , dailyentryId = '129',isService = '0',isOptic = '0',lastbuyprice = '315.00',lastbuyprice_withDiscount = '315',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.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='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8584',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '774';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (774, 1,'2026-10-22 14:49:02',7)
                ON DUPLICATE KEY UPDATE productid = 774, edited = 1, sysdate = '2026-10-22 14:49:02', userid = 7; -- id=1419
UPDATE productunit SET proUnitSellAllPrice  = 265.00 * productnumber  WHERE productid = 777;
UPDATE product SET productName = 'موديلات 265 شبابي', productDescription = '', productCatId = '13', productBuyPrice = '245.00', productSellAllPrice = '265.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '60117',type ='0', expireDate = '0' , dailyentryId = '132',isService = '0',isOptic = '0',lastbuyprice = '245.00',lastbuyprice_withDiscount = '245',meanbuyprice = '245.00',meanbuyprice_withDiscount = '245' , productbuypricereal = '245.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='245',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='60117',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='245',meanbuyprice_withTax='245',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='245',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '777';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (777, 1,'2026-10-22 14:49:09',7)
                ON DUPLICATE KEY UPDATE productid = 777, edited = 1, sysdate = '2026-10-22 14:49:09', userid = 7; -- id=1422
UPDATE productunit SET proUnitBuyPrice  = 320.00 * productnumber WHERE productid = 776;
UPDATE product SET productName = 'وايد ليج الونش', productDescription = '', productCatId = '13', productBuyPrice = '320.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '04904',type ='0', expireDate = '0' , dailyentryId = '131',isService = '0',isOptic = '0',lastbuyprice = '320.00',lastbuyprice_withDiscount = '320',meanbuyprice = '320.00',meanbuyprice_withDiscount = '320' , productbuypricereal = '320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='4904',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '776';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (776, 1,'2026-10-22 14:49:18',7)
                ON DUPLICATE KEY UPDATE productid = 776, edited = 1, sysdate = '2026-10-22 14:49:18', userid = 7; -- id=1421
UPDATE productunit SET proUnitBuyPrice  = 295.00 * productnumber WHERE productid = 775;
UPDATE product SET productName = 'قطن مخربيش الونش', productDescription = '', productCatId = '13', productBuyPrice = '295.00', productSellAllPrice = '315.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08585',type ='0', expireDate = '0' , dailyentryId = '130',isService = '0',isOptic = '0',lastbuyprice = '295.00',lastbuyprice_withDiscount = '295',meanbuyprice = '295.00',meanbuyprice_withDiscount = '295' , productbuypricereal = '295.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='295',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8585',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='295',meanbuyprice_withTax='295',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='295',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '775';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (775, 1,'2026-10-22 14:49:24',7)
                ON DUPLICATE KEY UPDATE productid = 775, edited = 1, sysdate = '2026-10-22 14:49:24', userid = 7; -- id=1420
UPDATE productunit SET proUnitSellAllPrice  = 335.00 * productnumber  WHERE productid = 774;
UPDATE product SET productName = 'موديلات 330 الونش', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '335.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08584',type ='0', expireDate = '0' , dailyentryId = '129',isService = '0',isOptic = '0',lastbuyprice = '315.00',lastbuyprice_withDiscount = '315',meanbuyprice = '315.00',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.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='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8584',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '774';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (774, 1,'2026-10-22 14:49:26',7)
                ON DUPLICATE KEY UPDATE productid = 774, edited = 1, sysdate = '2026-10-22 14:49:26', userid = 7; -- id=1419
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:19:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:49:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:49:58', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18476
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:23:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:53:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:53:17', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18477
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:23:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:53:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:53:18', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18478
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('بوي فرند ساده الونش','','13','310','325','0','0','2026-10-22','0','7','0','','0','0','0','0','0','310','310','310','310','310','0','4.84','0','0','.','0','0','0','310','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','310','310','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','310','0','0','0','0','0','0','','','0','0','0','0'); -- id=2447
UPDATE product SET productName = 'بوي فرند ساده الونش', productDescription = '', productCatId = '13', productBuyPrice = '310', productSellAllPrice = '325', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02447',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '4.84' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2447';
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', '2447', '1', '2026-10-22', '7', '0','0244701','325','0','0','310','','0','0','0','0','0','0','0','0','0','0'); -- id=2447
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2447', '1', '0', '7', '2026-10-22'); -- id=3842
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2447', '1', '0', '0', '2447', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16902
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2447, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2447, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3657
UPDATE product SET productName = 'بوي فرند ساده الونش', productDescription = '', productCatId = '13', productBuyPrice = '310.00', productSellAllPrice = '325.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02447',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310' , buypricereal_precentage = '0' , buytotal_precentage = '4.84' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2447';
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 ('موديلات الونش 330','','13','315','330','0','0','2026-10-22','0','7','0','','0','0','0','0','0','315','315','315','315','315','0','4.76','0','0','.','0','0','0','315','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','315','315','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','315','0','0','0','0','0','0','','','0','0','0','0'); -- id=2448
UPDATE product SET productName = 'موديلات الونش 330', productDescription = '', productCatId = '13', productBuyPrice = '315', productSellAllPrice = '330', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02448',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '315',lastbuyprice_withDiscount = '315',meanbuyprice = '315',meanbuyprice_withDiscount = '315' , productbuypricereal = '315' , buypricereal_precentage = '0' , buytotal_precentage = '4.76' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2448';
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', '2448', '1', '2026-10-22', '7', '0','0244801','330','0','0','315','','0','0','0','0','0','0','0','0','0','0'); -- id=2448
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2448', '1', '0', '7', '2026-10-22'); -- id=3843
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2448', '1', '0', '0', '2448', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16903
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2448, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2448, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3658
UPDATE product SET productName = 'موديلات الونش 330', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02448',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '315',lastbuyprice_withDiscount = '315',meanbuyprice = '315',meanbuyprice_withDiscount = '315' , productbuypricereal = '315' , buypricereal_precentage = '0' , buytotal_precentage = '4.76' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='315',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2448';
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 ('شبابي الونش','','13','305','320','0','0','2026-10-22','0','7','0','','0','0','0','0','0','305','305','305','305','305','0','4.92','0','0','.','0','0','0','305','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','305','305','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','305','0','0','0','0','0','0','','','0','0','0','0'); -- id=2449
UPDATE product SET productName = 'شبابي الونش', productDescription = '', productCatId = '13', productBuyPrice = '305', productSellAllPrice = '320', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02449',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '305',lastbuyprice_withDiscount = '305',meanbuyprice = '305',meanbuyprice_withDiscount = '305' , productbuypricereal = '305' , buypricereal_precentage = '0' , buytotal_precentage = '4.92' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='305',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='305',meanbuyprice_withTax='305',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='305',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2449';
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', '2449', '1', '2026-10-22', '7', '0','0244901','320','0','0','305','','0','0','0','0','0','0','0','0','0','0'); -- id=2449
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2449', '1', '0', '7', '2026-10-22'); -- id=3844
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2449', '1', '0', '0', '2449', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16904
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2449, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2449, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3659
UPDATE product SET productName = 'شبابي الونش', productDescription = '', productCatId = '13', productBuyPrice = '305.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02449',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '305',lastbuyprice_withDiscount = '305',meanbuyprice = '305',meanbuyprice_withDiscount = '305' , productbuypricereal = '305' , buypricereal_precentage = '0' , buytotal_precentage = '4.92' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='305',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='305',meanbuyprice_withTax='305',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='305',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2449';
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 ('خاص الونش','','13','345','360','0','0','2026-10-22','0','7','0','','0','0','0','0','0','345','345','345','345','345','0','4.35','0','0','.','0','0','0','345','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','345','345','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','345','0','0','0','0','0','0','','','0','0','0','0'); -- id=2450
UPDATE product SET productName = 'خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '345', productSellAllPrice = '360', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02450',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '4.35' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2450';
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', '2450', '1', '2026-10-22', '7', '0','0245001','360','0','0','345','','0','0','0','0','0','0','0','0','0','0'); -- id=2450
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2450', '1', '0', '7', '2026-10-22'); -- id=3845
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2450', '1', '0', '0', '2450', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16905
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2450, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2450, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3660
UPDATE product SET productName = 'خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '345.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02450',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345' , buypricereal_precentage = '0' , buytotal_precentage = '4.35' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2450';
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 ('مقطع الونش','','13','320','335','0','0','2026-10-22','0','7','0','','0','0','0','0','0','320','320','320','320','320','0','4.69','0','0','.','0','0','0','320','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','320','320','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','320','0','0','0','0','0','0','','','0','0','0','0'); -- id=2451
UPDATE product SET productName = 'مقطع الونش', productDescription = '', productCatId = '13', productBuyPrice = '320', productSellAllPrice = '335', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02451',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320' , buypricereal_precentage = '0' , buytotal_precentage = '4.69' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2451';
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', '2451', '1', '2026-10-22', '7', '0','0245101','335','0','0','320','','0','0','0','0','0','0','0','0','0','0'); -- id=2451
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2451', '1', '0', '7', '2026-10-22'); -- id=3846
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2451', '1', '0', '0', '2451', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16906
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2451, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2451, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3661
UPDATE product SET productName = 'مقطع الونش', productDescription = '', productCatId = '13', productBuyPrice = '320.00', productSellAllPrice = '335.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02451',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320' , buypricereal_precentage = '0' , buytotal_precentage = '4.69' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2451';
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 ('بلستر خاص الونش','','13','285','300','0','0','2026-10-22','0','7','0','','0','0','0','0','0','285','285','285','285','285','0','5.26','0','0','.','0','0','0','285','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','285','285','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','285','0','0','0','0','0','0','','','0','0','0','0'); -- id=2452
UPDATE product SET productName = 'بلستر خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '285', productSellAllPrice = '300', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02452',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '285',lastbuyprice_withDiscount = '285',meanbuyprice = '285',meanbuyprice_withDiscount = '285' , productbuypricereal = '285' , buypricereal_precentage = '0' , buytotal_precentage = '5.26' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='285',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='285',meanbuyprice_withTax='285',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='285',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2452';
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', '2452', '1', '2026-10-22', '7', '0','0245201','300','0','0','285','','0','0','0','0','0','0','0','0','0','0'); -- id=2452
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2452', '1', '0', '7', '2026-10-22'); -- id=3847
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2452', '1', '0', '0', '2452', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16907
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2452, 1,'2026-10-22 14:53:18',7)
                ON DUPLICATE KEY UPDATE productid = 2452, edited = 1, sysdate = '2026-10-22 14:53:18', userid = 7; -- id=3662
UPDATE product SET productName = 'بلستر خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '285.00', productSellAllPrice = '300.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02452',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '285',lastbuyprice_withDiscount = '285',meanbuyprice = '285',meanbuyprice_withDiscount = '285' , productbuypricereal = '285' , buypricereal_precentage = '0' , buytotal_precentage = '5.26' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='285',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='285',meanbuyprice_withTax='285',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='285',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2452';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:23:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:53:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:53:20', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18479
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:23:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:53:21", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:53:21', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18480
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:55:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:55:41', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18481
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:26:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:56:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:56:11', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18482
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 ('06ad9f931d0b16', '2026-10-22 14:53:21', '5', '466082.00', '656722', '0', '0', '190640.00',  '190640.00', '0', '190640', '1', '2026-10-22 14:56:11', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=340
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 ('02447', '340', '13', '2447', '80', '310', '24800.00', '0', '', '2026-10-22 14:56:11', '2447','','','0','0','0','0','0',null,'310','24800','0','0','0','0','0','0','0','0','1'); -- id=1806
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2447, 0, 0
                    , 310, 80, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 310,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7132
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2447', '310', '80', '0', 'buyBillController.php', '1806', '', '0', '0'); -- id=1352
UPDATE product SET  productBuyPrice = "310" WHERE productId = 2447 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1806 ;
UPDATE product SET productName = 'بوي فرند ساده الونش', productDescription = '', productCatId = '13', productBuyPrice = '310.00', productSellAllPrice = '325.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02447',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.84' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2447';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 310, meanbuyprice_withDiscount = 310
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where buybilldetailid = 1806;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 2447;
UPDATE storedetail SET  productquantity = '80', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3842';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2447', '1', '80', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '80', '7', '2026-10-22 14:53:21','0','0'); -- id=16908
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 ('02448', '340', '13', '2448', '80', '315', '25200.00', '0', '', '2026-10-22 14:56:11', '2448','','','0','0','0','0','0',null,'315','25200','0','0','0','0','0','0','0','0','1'); -- id=1807
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2448, 0, 0
                    , 315, 80, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7133
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2448', '315', '80', '0', 'buyBillController.php', '1807', '', '0', '0'); -- id=1353
UPDATE product SET  productBuyPrice = "315" WHERE productId = 2448 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1807 ;
UPDATE product SET productName = 'موديلات الونش 330', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02448',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '315',lastbuyprice_withDiscount = '315',meanbuyprice = '315',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.76' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='315',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2448';
UPDATE buybilldetail SET  lastbuyprice = 315 , meanbuyprice = 315, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 315
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 1807;
UPDATE productunit SET proUnitBuyPrice  = 315 * productnumber WHERE productid = 2448;
UPDATE storedetail SET  productquantity = '80', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3843';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2448', '1', '80', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '80', '7', '2026-10-22 14:53:21','0','0'); -- id=16909
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 ('02449', '340', '13', '2449', '96', '305', '29280.00', '0', '', '2026-10-22 14:56:11', '2449','','','0','0','0','0','0',null,'305','29280','0','0','0','0','0','0','0','0','1'); -- id=1808
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2449, 0, 0
                    , 305, 96, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 305,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7134
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2449', '305', '96', '0', 'buyBillController.php', '1808', '', '0', '0'); -- id=1354
UPDATE product SET  productBuyPrice = "305" WHERE productId = 2449 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1808 ;
UPDATE product SET productName = 'شبابي الونش', productDescription = '', productCatId = '13', productBuyPrice = '305.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02449',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '305',lastbuyprice_withDiscount = '305',meanbuyprice = '305',meanbuyprice_withDiscount = '305' , productbuypricereal = '305.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.92' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='305',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='305',meanbuyprice_withTax='305',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='305',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2449';
UPDATE buybilldetail SET  lastbuyprice = 305 , meanbuyprice = 305, lastbuyprice_withDiscount = 305, meanbuyprice_withDiscount = 305
        , lastbuyprice_withTax = 305, meanbuyprice_withTax = 305, lastbuyprice_withDiscountAndTax = 305
                where buybilldetailid = 1808;
UPDATE productunit SET proUnitBuyPrice  = 305 * productnumber WHERE productid = 2449;
UPDATE storedetail SET  productquantity = '96', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3844';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2449', '1', '96', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '96', '7', '2026-10-22 14:53:21','0','0'); -- id=16910
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 ('02450', '340', '13', '2450', '80', '345', '27600.00', '0', '', '2026-10-22 14:56:11', '2450','','','0','0','0','0','0',null,'345','27600','0','0','0','0','0','0','0','0','1'); -- id=1809
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2450, 0, 0
                    , 345, 80, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 345,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7135
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2450', '345', '80', '0', 'buyBillController.php', '1809', '', '0', '0'); -- id=1355
UPDATE product SET  productBuyPrice = "345" WHERE productId = 2450 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1809 ;
UPDATE product SET productName = 'خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '345.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02450',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '345',lastbuyprice_withDiscount = '345',meanbuyprice = '345',meanbuyprice_withDiscount = '345' , productbuypricereal = '345.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.35' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='345',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='345',meanbuyprice_withTax='345',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='345',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2450';
UPDATE buybilldetail SET  lastbuyprice = 345 , meanbuyprice = 345, lastbuyprice_withDiscount = 345, meanbuyprice_withDiscount = 345
        , lastbuyprice_withTax = 345, meanbuyprice_withTax = 345, lastbuyprice_withDiscountAndTax = 345
                where buybilldetailid = 1809;
UPDATE productunit SET proUnitBuyPrice  = 345 * productnumber WHERE productid = 2450;
UPDATE storedetail SET  productquantity = '80', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3845';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2450', '1', '80', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '80', '7', '2026-10-22 14:53:21','0','0'); -- id=16911
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 ('02448', '340', '13', '2448', '96', '315', '30240.00', '0', '', '2026-10-22 14:56:11', '2448','','','0','0','0','0','0',null,'315','30240','0','0','0','0','0','0','0','0','1'); -- id=1810
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2448, 0, 0
                    , 315, 96, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 315,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7133
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2448', '315', '96', '0', 'buyBillController.php', '1810', '', '0', '0'); -- id=1356
UPDATE product SET  productBuyPrice = "315" WHERE productId = 2448 ;
UPDATE buybilldetail SET  quantitybefore = 80 WHERE buybilldetailid = 1810 ;
UPDATE product SET productName = 'موديلات الونش 330', productDescription = '', productCatId = '13', productBuyPrice = '315.00', productSellAllPrice = '330.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02448',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '315',lastbuyprice_withDiscount = '315',meanbuyprice = '315',meanbuyprice_withDiscount = '315' , productbuypricereal = '315.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.76' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='315',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='315',meanbuyprice_withTax='315',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='315',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2448';
UPDATE buybilldetail SET  lastbuyprice = 315 , meanbuyprice = 315, lastbuyprice_withDiscount = 315, meanbuyprice_withDiscount = 315
        , lastbuyprice_withTax = 315, meanbuyprice_withTax = 315, lastbuyprice_withDiscountAndTax = 315
                where buybilldetailid = 1810;
UPDATE productunit SET proUnitBuyPrice  = 315 * productnumber WHERE productid = 2448;
UPDATE storedetail SET  productquantity = '176', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3843';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2448', '1', '96', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '80', '176', '7', '2026-10-22 14:53:21','0','0'); -- id=16912
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 ('02451', '340', '13', '2451', '96', '320', '30720.00', '0', '', '2026-10-22 14:56:11', '2451','','','0','0','0','0','0',null,'320','30720','0','0','0','0','0','0','0','0','1'); -- id=1811
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2451, 0, 0
                    , 320, 96, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 320,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7137
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2451', '320', '96', '0', 'buyBillController.php', '1811', '', '0', '0'); -- id=1357
UPDATE product SET  productBuyPrice = "320" WHERE productId = 2451 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1811 ;
UPDATE product SET productName = 'مقطع الونش', productDescription = '', productCatId = '13', productBuyPrice = '320.00', productSellAllPrice = '335.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02451',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.69' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2451';
UPDATE buybilldetail SET  lastbuyprice = 320 , meanbuyprice = 320, lastbuyprice_withDiscount = 320, meanbuyprice_withDiscount = 320
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where buybilldetailid = 1811;
UPDATE productunit SET proUnitBuyPrice  = 320 * productnumber WHERE productid = 2451;
UPDATE storedetail SET  productquantity = '96', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3846';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2451', '1', '96', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '96', '7', '2026-10-22 14:53:21','0','0'); -- id=16913
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 ('02452', '340', '13', '2452', '80', '285', '22800.00', '0', '', '2026-10-22 14:56:11', '2452','','','0','0','0','0','0',null,'285','22800','0','0','0','0','0','0','0','0','1'); -- id=1812
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 14:53:21', 1, 2452, 0, 0
                    , 285, 80, 0, 0, 7, '2026-10-22 14:56:11')
                ON DUPLICATE KEY UPDATE buyprice = 285,
                        buyQuantity =buyQuantity+80, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 14:56:11' ; -- id=7138
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2452', '285', '80', '0', 'buyBillController.php', '1812', '', '0', '0'); -- id=1358
UPDATE product SET  productBuyPrice = "285" WHERE productId = 2452 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1812 ;
UPDATE product SET productName = 'بلستر خاص الونش', productDescription = '', productCatId = '13', productBuyPrice = '285.00', productSellAllPrice = '300.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02452',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '285',lastbuyprice_withDiscount = '285',meanbuyprice = '285',meanbuyprice_withDiscount = '285' , productbuypricereal = '285.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.26' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='285',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='285',meanbuyprice_withTax='285',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='285',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2452';
UPDATE buybilldetail SET  lastbuyprice = 285 , meanbuyprice = 285, lastbuyprice_withDiscount = 285, meanbuyprice_withDiscount = 285
        , lastbuyprice_withTax = 285, meanbuyprice_withTax = 285, lastbuyprice_withDiscountAndTax = 285
                where buybilldetailid = 1812;
UPDATE productunit SET proUnitBuyPrice  = 285 * productnumber WHERE productid = 2452;
UPDATE storedetail SET  productquantity = '80', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3847';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2452', '1', '80', '0', '340', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '80', '7', '2026-10-22 14:53:21','0','0'); -- id=16914
UPDATE supplier SET  suppliercurrentDebt = '656722',suppliercurrentDebtInCurrency= '656722' , userid = '7', supplierdate = '2026-10-22 14:56:11'   WHERE supplierid = '5';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('5', '466082.00', '190640', '0', 'اضافة فاتورة مشتريات', '340', '656722', '2026-10-22 14:53:21', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','190640','1','466082','190640','656722','0',''); -- id=890
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '190640', '190640', '2026-10-22', '7', '0', '0', '2026-10-22 14:56:11','اضافة فاتورة مشتريات رقم 340','1','0',null,'0','340','buyBillController.php?do=details&id=340'); -- id=4568
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4568', '382', '190640', '','0'); -- id=4698
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26886026.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4568', '424', '190640', '','0'); -- id=4570
UPDATE accountstree SET name = 'الونش - مورد', customName = 'الونش - مورد', customNameEn = 'الونش - مورد', nameEn = 'الونش - مورد', parent = '81', accountNature = '1', theValue = '110640', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '424';
update buybill set dailyentryid='4568,0' where buybillid=340;
COMMIT;
UPDATE product SET overAllAveragePrice = 310 WHERE productId = 2447;UPDATE product SET overAllAveragePrice = 315 WHERE productId = 2448;UPDATE product SET overAllAveragePrice = 305 WHERE productId = 2449;UPDATE product SET overAllAveragePrice = 345 WHERE productId = 2450;UPDATE product SET overAllAveragePrice = 320 WHERE productId = 2451;UPDATE product SET overAllAveragePrice = 285 WHERE productId = 2452;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:26:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:56:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 14:56:11', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=340'); -- id=18483
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:26:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:56:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 14:56:15', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=340&type=2'); -- id=18484
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:27:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:57:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:57:04', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18485

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f9bde9991
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f9bde9991 and sellbillId = 1329 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:27:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:57:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 14:57:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18486
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:28:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 14:58:38", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 14:58:38', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18487
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:31:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:01:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:01:19', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18488
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:35:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:05:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:05:29', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18489
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:36:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:06:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:06:23', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18490
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:38:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:08:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:08:15', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18491
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:40:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:10:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:10:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18492
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:42:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:12:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:12:41', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18493
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:42:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:12:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:12:53', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18494
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:42:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:12:53", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:12:53', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18495
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:43:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:13:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:13:08', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18496
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:43:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:13:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:13:19', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18497
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:43:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:13:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:13:29', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18498
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:44:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:14:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:14:01', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18499

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9fdc5d2b67
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9fdc5d2b67 and sellbillId = 1330 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:44:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:14:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:14:02', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18500
UPDATE product SET productName = 'موديل 370 ستيفن', productDescription = '', productCatId = '25', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09766',type ='0', expireDate = '0' , dailyentryId = '254',isService = '0',isOptic = '0',lastbuyprice = '350.00',lastbuyprice_withDiscount = '350',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9766',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '899';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (899, 1,'2026-10-22 15:15:17',5)
                ON DUPLICATE KEY UPDATE productid = 899, edited = 1, sysdate = '2026-10-22 15:15:17', userid = 5; -- id=1544
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:45:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:15:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:15:25', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18501

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9fe0a90f90
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9fe0a90f90 and sellbillId = 1331 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:45:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:15:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:15:26', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18502
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:16:24', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18503

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9fe5e0f35e
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9fe5e0f35e and sellbillId = 1332 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:16:24', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18504
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:37", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:16:37', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18505
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:37", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:16:37', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18506
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:16:37', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18507
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:16:39', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18508
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:46:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:16:45", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:16:45', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18509
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:00", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:17:00', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18510
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:17:01', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18511
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:17:29', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18512
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 380 ستيفن ','','25','360','380','0','0','2026-10-22','0','5','0','','0','0','0','0','0','360','360','360','360','360','0','5.56','0','0','.','0','0','0','360','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','360','360','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','360','0','0','0','0','0','0','','','0','0','0','0'); -- id=2453
UPDATE product SET productName = 'موديل 380 ستيفن ', productDescription = '', productCatId = '25', productBuyPrice = '360', productSellAllPrice = '380', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02453',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '5.56' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2453';
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', '2453', '1', '2026-10-22', '5', '0','0245301','380','0','0','360','','0','0','0','0','0','0','0','0','0','0'); -- id=2453
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2453', '1', '0', '5', '2026-10-22'); -- id=3848
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2453', '1', '0', '0', '2453', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16920
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2453, 1,'2026-10-22 15:17:29',5)
                ON DUPLICATE KEY UPDATE productid = 2453, edited = 1, sysdate = '2026-10-22 15:17:29', userid = 5; -- id=3664
UPDATE product SET productName = 'موديل 380 ستيفن ', productDescription = '', productCatId = '25', productBuyPrice = '360.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02453',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '5.56' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2453';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:17:30', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18513
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:17:32', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18514
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:17:47', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=340&type=2'); -- id=18515
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:52", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:17:52', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18516
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:17:58', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18517
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:47:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:17:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:17:59', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18518
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:48:57";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:00", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:19:00', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18519
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:00";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:19:00', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18520
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:19:05', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18521
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:06", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:19:06', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18522
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:19:08', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18523
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:22", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:19:22', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18524
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:49:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:19:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:19:24', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18525
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:50:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:20:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:20:08', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18526
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديلات 830 او ار','','143','800','830','0','0','2026-10-22','0','7','0','','0','0','0','0','0','800','800','800','800','800','0','3.75','0','0','.','0','0','0','800','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','800','800','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','800','0','0','0','0','0','0','','','0','0','0','0'); -- id=2454
UPDATE product SET productName = 'موديلات 830 او ار', productDescription = '', productCatId = '143', productBuyPrice = '800', productSellAllPrice = '830', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02454',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800' , buypricereal_precentage = '0' , buytotal_precentage = '3.75' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2454';
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', '2454', '1', '2026-10-22', '7', '0','0245401','830','0','0','800','','0','0','0','0','0','0','0','0','0','0'); -- id=2454
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2454', '1', '0', '7', '2026-10-22'); -- id=3849
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2454', '1', '0', '0', '2454', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16921
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2454, 1,'2026-10-22 15:20:08',7)
                ON DUPLICATE KEY UPDATE productid = 2454, edited = 1, sysdate = '2026-10-22 15:20:08', userid = 7; -- id=3665
UPDATE product SET productName = 'موديلات 830 او ار', productDescription = '', productCatId = '143', productBuyPrice = '800.00', productSellAllPrice = '830.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02454',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800' , buypricereal_precentage = '0' , buytotal_precentage = '3.75' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2454';
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 ('جاكت 339 او ار','','143','700','730','0','0','2026-10-22','0','7','0','','0','0','0','0','0','700','700','700','700','700','0','4.29','0','0','.','0','0','0','700','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','700','700','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','700','0','0','0','0','0','0','','','0','0','0','0'); -- id=2455
UPDATE product SET productName = 'جاكت 339 او ار', productDescription = '', productCatId = '143', productBuyPrice = '700', productSellAllPrice = '730', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02455',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700' , buypricereal_precentage = '0' , buytotal_precentage = '4.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2455';
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', '2455', '1', '2026-10-22', '7', '0','0245501','730','0','0','700','','0','0','0','0','0','0','0','0','0','0'); -- id=2455
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2455', '1', '0', '7', '2026-10-22'); -- id=3850
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2455', '1', '0', '0', '2455', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16922
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2455, 1,'2026-10-22 15:20:08',7)
                ON DUPLICATE KEY UPDATE productid = 2455, edited = 1, sysdate = '2026-10-22 15:20:08', userid = 7; -- id=3666
UPDATE product SET productName = 'جاكت 339 او ار', productDescription = '', productCatId = '143', productBuyPrice = '700.00', productSellAllPrice = '730.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02455',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700' , buypricereal_precentage = '0' , buytotal_precentage = '4.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2455';
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 ('جاكت 335 او ار','','143','820','850','0','0','2026-10-22','0','7','0','','0','0','0','0','0','820','820','820','820','820','0','3.66','0','0','.','0','0','0','820','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','820','820','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','820','0','0','0','0','0','0','','','0','0','0','0'); -- id=2456
UPDATE product SET productName = 'جاكت 335 او ار', productDescription = '', productCatId = '143', productBuyPrice = '820', productSellAllPrice = '850', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '820',lastbuyprice_withDiscount = '820',meanbuyprice = '820',meanbuyprice_withDiscount = '820' , productbuypricereal = '820' , buypricereal_precentage = '0' , buytotal_precentage = '3.66' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='820',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='820',meanbuyprice_withTax='820',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='820',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2456';
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', '2456', '1', '2026-10-22', '7', '0','0245601','850','0','0','820','','0','0','0','0','0','0','0','0','0','0'); -- id=2456
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2456', '1', '0', '7', '2026-10-22'); -- id=3851
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2456', '1', '0', '0', '2456', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=16923
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2456, 1,'2026-10-22 15:20:08',7)
                ON DUPLICATE KEY UPDATE productid = 2456, edited = 1, sysdate = '2026-10-22 15:20:08', userid = 7; -- id=3667
UPDATE product SET productName = 'جاكت 335 او ار', productDescription = '', productCatId = '143', productBuyPrice = '820.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '820',lastbuyprice_withDiscount = '820',meanbuyprice = '820',meanbuyprice_withDiscount = '820' , productbuypricereal = '820' , buypricereal_precentage = '0' , buytotal_precentage = '3.66' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='820',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='820',meanbuyprice_withTax='820',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='820',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2456';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:50:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:20:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:20:10', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18527
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:50:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:20:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:20:10', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18528
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:50:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:20:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:20:10', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18529
UPDATE product SET productName = 'موديل 340 ستيفن', productDescription = '', productCatId = '25', productBuyPrice = '340.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05022',type ='0', expireDate = '0' , dailyentryId = '245',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5022',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='340',meanbuyprice_withTax='340',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '890';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (890, 1,'2026-10-22 15:20:15',5)
                ON DUPLICATE KEY UPDATE productid = 890, edited = 1, sysdate = '2026-10-22 15:20:15', userid = 5; -- id=1535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:50:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:20:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:20:41', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18530
UPDATE product SET productName = 'موديل 340 ستيفن ', productDescription = '', productCatId = '25', productBuyPrice = '320.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08564',type ='0', expireDate = '0' , dailyentryId = '248',isService = '0',isOptic = '0',lastbuyprice = '320.00',lastbuyprice_withDiscount = '320',meanbuyprice = '320.00',meanbuyprice_withDiscount = '320' , productbuypricereal = '320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8564',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '893';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (893, 1,'2026-10-22 15:21:09',5)
                ON DUPLICATE KEY UPDATE productid = 893, edited = 1, sysdate = '2026-10-22 15:21:09', userid = 5; -- id=1538
UPDATE product SET productName = 'موديل 360 ستيفن', productDescription = '', productCatId = '25', productBuyPrice = '340.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '05022',type ='0', expireDate = '0' , dailyentryId = '245',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '340',meanbuyprice = '340.00',meanbuyprice_withDiscount = '340' , productbuypricereal = '340.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='340',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='5022',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='340',meanbuyprice_withTax='340',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='340',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '890';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (890, 1,'2026-10-22 15:21:33',5)
                ON DUPLICATE KEY UPDATE productid = 890, edited = 1, sysdate = '2026-10-22 15:21:33', userid = 5; -- id=1535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:22:24', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18531
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 ('06ad9ff7ad9a0b', '2026-10-22 15:20:10', '147', '170600.00', '263000', '0', '0', '92400.00',  '92400.00', '0', '92400', '1', '2026-10-22 15:22:24', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=341
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 ('02454', '341', '143', '2454', '24', '800', '19200.00', '0', '', '2026-10-22 15:22:24', '2454','','','0','0','0','0','0',null,'800','19200','0','0','0','0','0','0','0','0','1'); -- id=1813
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:20:10', 1, 2454, 0, 0
                    , 800, 24, 0, 0, 7, '2026-10-22 15:22:24')
                ON DUPLICATE KEY UPDATE buyprice = 800,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 15:22:24' ; -- id=7139
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2454', '800', '24', '0', 'buyBillController.php', '1813', '', '0', '0'); -- id=1359
UPDATE product SET  productBuyPrice = "800" WHERE productId = 2454 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1813 ;
UPDATE product SET productName = 'موديلات 830 او ار', productDescription = '', productCatId = '143', productBuyPrice = '800.00', productSellAllPrice = '830.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02454',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.75' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2454';
UPDATE buybilldetail SET  lastbuyprice = 800 , meanbuyprice = 800, lastbuyprice_withDiscount = 800, meanbuyprice_withDiscount = 800
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where buybilldetailid = 1813;
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2454;
UPDATE storedetail SET  productquantity = '24', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3849';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2454', '1', '24', '0', '341', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '7', '2026-10-22 15:20:10','0','0'); -- id=16924
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 ('02455', '341', '143', '2455', '28', '700', '19600.00', '0', '', '2026-10-22 15:22:24', '2455','','','0','0','0','0','0',null,'700','19600','0','0','0','0','0','0','0','0','1'); -- id=1814
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:20:10', 1, 2455, 0, 0
                    , 700, 28, 0, 0, 7, '2026-10-22 15:22:24')
                ON DUPLICATE KEY UPDATE buyprice = 700,
                        buyQuantity =buyQuantity+28, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 15:22:24' ; -- id=7140
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2455', '700', '28', '0', 'buyBillController.php', '1814', '', '0', '0'); -- id=1360
UPDATE product SET  productBuyPrice = "700" WHERE productId = 2455 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1814 ;
UPDATE product SET productName = 'جاكت 339 او ار', productDescription = '', productCatId = '143', productBuyPrice = '700.00', productSellAllPrice = '730.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02455',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '700',lastbuyprice_withDiscount = '700',meanbuyprice = '700',meanbuyprice_withDiscount = '700' , productbuypricereal = '700.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.29' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='700',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='700',meanbuyprice_withTax='700',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='700',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2455';
UPDATE buybilldetail SET  lastbuyprice = 700 , meanbuyprice = 700, lastbuyprice_withDiscount = 700, meanbuyprice_withDiscount = 700
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 700, lastbuyprice_withDiscountAndTax = 700
                where buybilldetailid = 1814;
UPDATE productunit SET proUnitBuyPrice  = 700 * productnumber WHERE productid = 2455;
UPDATE storedetail SET  productquantity = '28', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3850';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2455', '1', '28', '0', '341', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '28', '7', '2026-10-22 15:20:10','0','0'); -- id=16925
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 ('02454', '341', '143', '2454', '24', '800', '19200.00', '0', '', '2026-10-22 15:22:24', '2454','','','0','0','0','0','0',null,'800','19200','0','0','0','0','0','0','0','0','1'); -- id=1815
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:20:10', 1, 2454, 0, 0
                    , 800, 24, 0, 0, 7, '2026-10-22 15:22:24')
                ON DUPLICATE KEY UPDATE buyprice = 800,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 15:22:24' ; -- id=7139
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2454', '800', '24', '0', 'buyBillController.php', '1815', '', '0', '0'); -- id=1361
UPDATE product SET  productBuyPrice = "800" WHERE productId = 2454 ;
UPDATE buybilldetail SET  quantitybefore = 24 WHERE buybilldetailid = 1815 ;
UPDATE product SET productName = 'موديلات 830 او ار', productDescription = '', productCatId = '143', productBuyPrice = '800.00', productSellAllPrice = '830.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02454',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.75' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2454';
UPDATE buybilldetail SET  lastbuyprice = 800 , meanbuyprice = 800, lastbuyprice_withDiscount = 800, meanbuyprice_withDiscount = 800
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where buybilldetailid = 1815;
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2454;
UPDATE storedetail SET  productquantity = '48', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3849';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2454', '1', '24', '0', '341', 'اضافة فاتورة مشتريات', 'buyBillController.php', '24', '48', '7', '2026-10-22 15:20:10','0','0'); -- id=16926
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 ('02456', '341', '143', '2456', '20', '820', '16400.00', '0', '', '2026-10-22 15:22:24', '2456','','','0','0','0','0','0',null,'820','16400','0','0','0','0','0','0','0','0','1'); -- id=1816
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:20:10', 1, 2456, 0, 0
                    , 820, 20, 0, 0, 7, '2026-10-22 15:22:24')
                ON DUPLICATE KEY UPDATE buyprice = 820,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 15:22:24' ; -- id=7142
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2456', '820', '20', '0', 'buyBillController.php', '1816', '', '0', '0'); -- id=1362
UPDATE product SET  productBuyPrice = "820" WHERE productId = 2456 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1816 ;
UPDATE product SET productName = 'جاكت 335 او ار', productDescription = '', productCatId = '143', productBuyPrice = '820.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '820',lastbuyprice_withDiscount = '820',meanbuyprice = '820',meanbuyprice_withDiscount = '820' , productbuypricereal = '820.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.66' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='820',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='820',meanbuyprice_withTax='820',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='820',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2456';
UPDATE buybilldetail SET  lastbuyprice = 820 , meanbuyprice = 820, lastbuyprice_withDiscount = 820, meanbuyprice_withDiscount = 820
        , lastbuyprice_withTax = 820, meanbuyprice_withTax = 820, lastbuyprice_withDiscountAndTax = 820
                where buybilldetailid = 1816;
UPDATE productunit SET proUnitBuyPrice  = 820 * productnumber WHERE productid = 2456;
UPDATE storedetail SET  productquantity = '20', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3851';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2456', '1', '20', '0', '341', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '7', '2026-10-22 15:20:10','0','0'); -- id=16927
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 ('01852', '341', '143', '1852', '24', '750', '18000.00', '0', '', '2026-10-22 15:22:24', '1852','','','0','0','0','0','0',null,'750','18000','0','0','0','0','0','0','0','0','1'); -- id=1817
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:20:10', 1, 1852, 0, 0
                    , 750, 24, 0, 0, 7, '2026-10-22 15:22:24')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 15:22:24' ; -- id=7143
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1852', '750', '24', '0', 'buyBillController.php', '1817', '', '0', '0'); -- id=1363
UPDATE product SET  productBuyPrice = "750" WHERE productId = 1852 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1817 ;
UPDATE product SET productName = 'جاكيت 308 او ار ', productDescription = '', productCatId = '143', productBuyPrice = '750.00', productSellAllPrice = '780.00', productSellUnitPrice = '780.00', productSellHalfPrice = '780.00', productDate = '2026-10-12', conditions = '0', userId = '1', limitamount = '0', parcode = '01852',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '750',meanbuyprice_withDiscount = '750' , productbuypricereal = '750.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='750',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='750',meanbuyprice_withTax='750',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1852';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 750, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 750
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 1817;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 1852;
UPDATE storedetail SET  productquantity = '24', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2869';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1852', '1', '24', '0', '341', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '7', '2026-10-22 15:20:10','0','0'); -- id=16928
UPDATE supplier SET  suppliercurrentDebt = '263000',suppliercurrentDebtInCurrency= '263000' , userid = '7', supplierdate = '2026-10-22 15:22:24'   WHERE supplierid = '147';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('147', '170600.00', '92400', '0', 'اضافة فاتورة مشتريات', '341', '263000', '2026-10-22 15:20:10', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','92400','1','170600','92400','263000','0',''); -- id=891
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '92400', '92400', '2026-10-22', '7', '0', '0', '2026-10-22 15:22:24','اضافة فاتورة مشتريات رقم 341','1','0',null,'0','341','buyBillController.php?do=details&id=341'); -- id=4577
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4577', '382', '92400', '','0'); -- id=4707
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '26970480.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4577', '630', '92400', '','0'); -- id=4579
UPDATE accountstree SET name = 'او ار', customName = 'او ار', customNameEn = 'او ار', nameEn = 'او ار', parent = '81', accountNature = '1', theValue = '263000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:33:59' WHERE id = '630';
update buybill set dailyentryid='4577,0' where buybillid=341;
COMMIT;
UPDATE product SET overAllAveragePrice = 750 WHERE productId = 1852;UPDATE product SET overAllAveragePrice = 800 WHERE productId = 2454;UPDATE product SET overAllAveragePrice = 700 WHERE productId = 2455;UPDATE product SET overAllAveragePrice = 820 WHERE productId = 2456;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:22:25', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=341'); -- id=18532
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:22:26', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18533
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:22:27', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18534

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f65f47b43
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f65f47b43 and sellbillId = 1333 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:22:27', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18535
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:22:29', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=341&type=2'); -- id=18536
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:52:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:22:42", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:22:42', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18537
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:53:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:23:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:23:05', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18538

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0002d9bfa
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0002d9bfa and sellbillId = 1334 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:53:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:23:06", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:23:06', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18539
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:54:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:24:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:24:13', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18540
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 ('06ad9fedcb267e', '2026-10-22 15:17:32', '62', '320735.00', '447085', '0', '0', '126350.00',  '126350.00', '0', '126350', '1', '2026-10-22 15:24:13', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=342
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 ('08564', '342', '25', '893', '100', '320', '32000.00', '0', '', '2026-10-22 15:24:13', '893','','','0','0','0','0','0',null,'320','32000','0','0','0','0','0','0','0','0','1'); -- id=1818
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:17:32', 1, 893, 0, 0
                    , 320, 100, 0, 0, 5, '2026-10-22 15:24:13')
                ON DUPLICATE KEY UPDATE buyprice = 320,
                        buyQuantity =buyQuantity+100, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 15:24:13' ; -- id=7144
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('893', '320', '100', '0', 'buyBillController.php', '1818', '', '0', '0'); -- id=1364
UPDATE product SET  productBuyPrice = "320" WHERE productId = 893 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1818 ;
UPDATE product SET productName = 'موديل 340 ستيفن ', productDescription = '', productCatId = '25', productBuyPrice = '320.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '08564',type ='0', expireDate = '0' , dailyentryId = '248',isService = '0',isOptic = '0',lastbuyprice = '320',lastbuyprice_withDiscount = '320',meanbuyprice = '320',meanbuyprice_withDiscount = '320' , productbuypricereal = '320.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='320',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='8564',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='320',meanbuyprice_withTax='320',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='320',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '893';
UPDATE buybilldetail SET  lastbuyprice = 320 , meanbuyprice = 320, lastbuyprice_withDiscount = 320, meanbuyprice_withDiscount = 320
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where buybilldetailid = 1818;
UPDATE productunit SET proUnitBuyPrice  = 320 * productnumber WHERE productid = 893;
UPDATE storedetail SET  productquantity = '100', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '893';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('893', '1', '100', '0', '342', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '100', '5', '2026-10-22 15:17:32','0','0'); -- id=16931
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 ('09766', '342', '25', '899', '105', '350', '36750.00', '0', '', '2026-10-22 15:24:13', '899','','','0','0','0','0','0',null,'350','36750','0','0','0','0','0','0','0','0','1'); -- id=1819
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:17:32', 1, 899, 0, 0
                    , 350, 105, 0, 0, 5, '2026-10-22 15:24:13')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+105, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 15:24:13' ; -- id=7145
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('899', '350', '105', '0', 'buyBillController.php', '1819', '', '0', '0'); -- id=1365
UPDATE product SET  productBuyPrice = "350" WHERE productId = 899 ;
UPDATE buybilldetail SET  quantitybefore = 20 WHERE buybilldetailid = 1819 ;
UPDATE product SET productName = 'موديل 370 ستيفن', productDescription = '', productCatId = '25', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-09-27', conditions = '0', userId = '1', limitamount = '0', parcode = '09766',type ='0', expireDate = '0' , dailyentryId = '254',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='9766',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='1',sellpercenttype='0',searchfiltersid='1',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='1',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '899';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1819;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 899;
UPDATE storedetail SET  productquantity = '125', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '899';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('899', '1', '105', '0', '342', 'اضافة فاتورة مشتريات', 'buyBillController.php', '20', '125', '5', '2026-10-22 15:17:32','0','0'); -- id=16932
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 ('02453', '342', '25', '2453', '160', '360', '57600.00', '0', '', '2026-10-22 15:24:13', '2453','','','0','0','0','0','0',null,'360','57600','0','0','0','0','0','0','0','0','1'); -- id=1820
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:17:32', 1, 2453, 0, 0
                    , 360, 160, 0, 0, 5, '2026-10-22 15:24:13')
                ON DUPLICATE KEY UPDATE buyprice = 360,
                        buyQuantity =buyQuantity+160, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 15:24:13' ; -- id=7146
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2453', '360', '160', '0', 'buyBillController.php', '1820', '', '0', '0'); -- id=1366
UPDATE product SET  productBuyPrice = "360" WHERE productId = 2453 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1820 ;
UPDATE product SET productName = 'موديل 380 ستيفن ', productDescription = '', productCatId = '25', productBuyPrice = '360.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02453',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.56' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2453';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 360, lastbuyprice_withDiscount = 360, meanbuyprice_withDiscount = 360
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where buybilldetailid = 1820;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 2453;
UPDATE storedetail SET  productquantity = '160', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3848';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2453', '1', '160', '0', '342', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '160', '5', '2026-10-22 15:17:32','0','0'); -- id=16933
UPDATE supplier SET  suppliercurrentDebt = '447085',suppliercurrentDebtInCurrency= '447085' , userid = '5', supplierdate = '2026-10-22 15:24:13'   WHERE supplierid = '62';
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 ('62', '320735.00', '126350', '0', 'اضافة فاتورة مشتريات', '342', '447085', '2026-10-22 15:17:32', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','126350','1','320735','126350','447085','0',''); -- id=892
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '126350', '126350', '2026-10-22', '5', '0', '0', '2026-10-22 15:24:13','اضافة فاتورة مشتريات رقم 342','1','0',null,'0','342','buyBillController.php?do=details&id=342'); -- id=4582
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4582', '382', '126350', '','0'); -- id=4712
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27090370.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4582', '481', '126350', '','0'); -- id=4584
UPDATE accountstree SET name = 'ستيفن - مورد', customName = 'ستيفن - مورد', customNameEn = 'ستيفن - مورد', nameEn = 'ستيفن - مورد', parent = '81', accountNature = '1', theValue = '61350', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '481';
update buybill set dailyentryid='4582,0' where buybillid=342;
COMMIT;
UPDATE product SET overAllAveragePrice = 320 WHERE productId = 893;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 899;UPDATE product SET overAllAveragePrice = 360 WHERE productId = 2453;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:54:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:24:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:24:13', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=342'); -- id=18541
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:54:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:24:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:24:17', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=342&type=2'); -- id=18542
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:57:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:27:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:27:08', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18543
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:59:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:29:39", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:29:39', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18544

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ad9f750d7283
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ad9f750d7283 and sellbillId = 1335 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 11:59:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:29:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:29:41', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18545
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:33:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:33:32', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18546
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:32";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 15:33:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:33:32', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18547
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:33:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:33:34', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18548
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:33:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:33:41', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18549

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada002a391fc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 15:33:41', '06ada002a391fc', '1', '0.00', '0', '0', '1', '30580.00', '30580', '30580', '0', '1', '2026-10-22 15:33:41', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '68' ,'0','','','','','-1','0','0','0','0','0','30580','0','','0','0','30580','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1336
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1336', '0', '2026-10-22 15:33:41', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '30580', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 15:33:41','0','0','',''); -- id=1568
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7048;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('441.6','01898', '1336', '149', '1898', '3', '480', '1440', '0', '', '0', '2026-10-22 15:33:41', '1898', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7048-3,','1','1','0','0','480','1440','0','','0','0.00','0','0','0','0'); -- id=5327
UPDATE sellbilldetail SET  lastbuyprice = 480.00 , meanbuyprice = 480.00, lastbuyprice_withDiscount = 441.60, meanbuyprice_withDiscount = 445.09
        , lastbuyprice_withTax = 480, meanbuyprice_withTax = 436.36, lastbuyprice_withDiscountAndTax = 441.6
                where sellbilldetailid = 5327;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1898, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1335.27, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1440, 1309.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1335.27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1309.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1440, 1440, 1440
                    , 1440, 1324.8, 1335.27, 1324.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1440, 1309.08, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1440, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1324.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1335.27
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1324.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1309.08
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '10', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '2915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1898', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13', '10', '2', '2026-10-22 15:33:41','0','0'); -- id=16935
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6513;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('377.2','02149', '1336', '187', '2149', '3', '410', '1230', '0', '', '0', '2026-10-22 15:33:41', '2149', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6513-3,','1','1','0','0','410','1230','0','','0','0.00','0','0','0','0'); -- id=5328
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 377.20, meanbuyprice_withDiscount = 377.20
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 377.2
                where sellbilldetailid = 5328;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2149, '2026-10-22', 1230, 1230, 1230
                    , 1230, 1131.6, 1131.6, 1131.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1131.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1131.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1131.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1230, 1230, 1230
                    , 1230, 1131.6, 1131.6, 1131.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1230, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1131.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1131.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1131.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3508';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2149', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '57', '2', '2026-10-22 15:33:41','0','0'); -- id=16936
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7054;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('399.9','02394', '1336', '189', '2394', '3', '430', '1290', '0', '', '0', '2026-10-22 15:33:41', '2394', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7054-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=5329
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 399.90, meanbuyprice_withDiscount = 399.90
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 399.9
                where sellbilldetailid = 5329;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2394, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1199.7, 1199.7, 1199.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1199.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1199.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1199.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1199.7, 1199.7, 1199.7
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1199.7, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1199.7
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1199.7
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3789';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2394', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '2', '2026-10-22 15:33:41','0','0'); -- id=16937
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6304;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('550','02187', '1336', '190', '2187', '8', '575', '4600', '0', '', '0', '2026-10-22 15:33:41', '2187', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6304-8,','1','1','0','0','575','4600','0','','0','0.00','0','0','0','0'); -- id=5330
UPDATE sellbilldetail SET  lastbuyprice = 550.00 , meanbuyprice = 550.00, lastbuyprice_withDiscount = 550.00, meanbuyprice_withDiscount = 550.00
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 550
                where sellbilldetailid = 5330;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2187, '2026-10-22', 4600, 4400, 4400
                    , 4400, 4400, 4400, 4400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4400, 2200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4600, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4600, 4400, 4400
                    , 4400, 4400, 4400, 4400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4400, 2200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4600, sellCostBuyPrice =sellCostBuyPrice+4400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '7', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3547';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2187', '1', '8', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '7', '2', '2026-10-22 15:33:41','0','0'); -- id=16938
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6172;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('423.2','02105', '1336', '179', '2105', '3', '460', '1380', '0', '', '0', '2026-10-22 15:33:41', '2105', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6172-3,','1','1','0','0','460','1380','0','','0','0.00','0','0','0','0'); -- id=5331
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 423.20, meanbuyprice_withDiscount = 423.20
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 423.2
                where sellbilldetailid = 5331;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2105, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1380, 1380, 1380
                    , 1380, 1269.6, 1269.6, 1269.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1380, 1380, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1380
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1380, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1269.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1269.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1269.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1380
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1380
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '114', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3464';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2105', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '117', '114', '2', '2026-10-22 15:33:41','0','0'); -- id=16939
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6167;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('331.2','02104', '1336', '179', '2104', '3', '360', '1080', '0', '', '0', '2026-10-22 15:33:41', '2104', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6167-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=5332
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 331.20, meanbuyprice_withDiscount = 331.20
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 331.2
                where sellbilldetailid = 5332;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2104, '2026-10-22', 1080, 1080, 1080
                    , 1080, 993.6, 993.6, 993.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+993.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+993.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+993.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1080, 1080, 1080
                    , 1080, 993.6, 993.6, 993.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+993.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+993.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+993.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3463';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2104', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '87', '2', '2026-10-22 15:33:41','0','0'); -- id=16940
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 216;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01435', '1336', '100', '1435', '3', '440', '1320', '0', '', '0', '2026-10-22 15:33:41', '1435', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','216-3,','1','1','0','0','440','1320','0','','0','0.00','0','0','0','0'); -- id=5333
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 407.50, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 407.50
        , lastbuyprice_withTax = 407.5, meanbuyprice_withTax = 407.5, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5333;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1435, '2026-10-22', 1320, 1215, 1230
                    , 1222.5, 1230, 1222.5, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1222.5, 1222.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1222.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1222.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1222.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1222.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1320, 1215, 1230
                    , 1222.5, 1230, 1222.5, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1222.5, 1222.5, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1215
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1222.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1222.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1222.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1222.5
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '1448';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1435', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '6', '2', '2026-10-22 15:33:41','0','0'); -- id=16941
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7051;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','02391', '1336', '209', '2391', '3', '440', '1320', '0', '', '0', '2026-10-22 15:33:41', '2391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7051-3,','1','1','0','0','440','1320','0','','0','0.00','0','0','0','0'); -- id=5334
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 5334;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2391, '2026-10-22', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3786';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2391', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '2', '2026-10-22 15:33:41','0','0'); -- id=16942
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6224;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','02136', '1336', '183', '2136', '3', '420', '1260', '0', '', '0', '2026-10-22 15:33:41', '2136', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6224-3,','1','1','0','0','420','1260','0','','0','0.00','0','0','0','0'); -- id=5335
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 5335;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2136, '2026-10-22', 1260, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1140, 570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1260, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1140, 570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '60', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3495';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2136', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '63', '60', '2', '2026-10-22 15:33:41','0','0'); -- id=16943
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6224;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('380','02136', '1336', '183', '2136', '3', '420', '1260', '0', '', '0', '2026-10-22 15:33:41', '2136', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6224-3,','1','1','0','0','420','1260','0','','0','0.00','0','0','0','0'); -- id=5336
UPDATE sellbilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 380
                where sellbilldetailid = 5336;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2136, '2026-10-22', 1260, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1140, 570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1260, 1140, 1140
                    , 1140, 1140, 1140, 1140
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1140, 570, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1260, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1140
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1140
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+570
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3495';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2136', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '57', '2', '2026-10-22 15:33:41','0','0'); -- id=16944
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6683;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','02250', '1336', '196', '2250', '3', '450', '1350', '0', '', '0', '2026-10-22 15:33:41', '2250', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6683-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5337
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 427.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 5337;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2250, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1282.5, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1282.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1282.5, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1282.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3641';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2250', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '2', '2026-10-22 15:33:41','0','0'); -- id=16945
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7069;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','02400', '1336', '138', '2400', '3', '465', '1395', '0', '', '0', '2026-10-22 15:33:41', '2400', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7069-3,','1','1','0','0','465','1395','0','','0','0.00','0','0','0','0'); -- id=5338
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5338;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2400, '2026-10-22', 1395, 1305, 1305
                    , 1305, 1305, 1305, 1305
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1305, 1305, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1305
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1305, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1305, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1305
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1305
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1305
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1395, 1305, 1305
                    , 1305, 1305, 1305, 1305
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1305, 1305, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1305
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1305, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1305, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1305
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1305
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1305
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3795';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2400', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '33', '30', '2', '2026-10-22 15:33:41','0','0'); -- id=16946
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7070;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01793', '1336', '138', '1793', '3', '455', '1365', '0', '', '0', '2026-10-22 15:33:41', '1793', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7070-3,','1','1','0','0','455','1365','0','','0','0.00','0','0','0','0'); -- id=5339
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5339;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1793, '2026-10-22', 1365, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1365, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1365, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1365, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15', '12', '2', '2026-10-22 15:33:41','0','0'); -- id=16947
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7051;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('404.8','02391', '1336', '209', '2391', '3', '440', '1320', '0', '', '0', '2026-10-22 15:33:41', '2391', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7051-3,','1','1','0','0','440','1320','0','','0','0.00','0','0','0','0'); -- id=5340
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 404.80, meanbuyprice_withDiscount = 404.80
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 404.8
                where sellbilldetailid = 5340;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2391, '2026-10-22', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1320, 1320, 1320
                    , 1320, 1214.4, 1214.4, 1214.4
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1320, 1320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1214.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1214.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1214.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3786';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2391', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '15', '2', '2026-10-22 15:33:41','0','0'); -- id=16948
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7050;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02390', '1336', '209', '2390', '3', '350', '1050', '0', '', '0', '2026-10-22 15:33:41', '2390', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7050-3,','1','1','0','0','350','1050','0','','0','0.00','0','0','0','0'); -- id=5341
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5341;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2390, '2026-10-22', 1050, 1050, 1050
                    , 1050, 966, 966, 966
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+966, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+966
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+966
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1050, 1050, 1050
                    , 1050, 966, 966, 966
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1050, 1050, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+1050
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1050, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1050
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+966, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+966
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+966
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1050
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1050
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '102', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3785';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2390', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '105', '102', '2', '2026-10-22 15:33:41','0','0'); -- id=16949
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7069;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('435','02400', '1336', '138', '2400', '3', '465', '1395', '0', '', '0', '2026-10-22 15:33:41', '2400', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7069-3,','1','1','0','0','465','1395','0','','0','0.00','0','0','0','0'); -- id=5342
UPDATE sellbilldetail SET  lastbuyprice = 435.00 , meanbuyprice = 435.00, lastbuyprice_withDiscount = 435.00, meanbuyprice_withDiscount = 435.00
        , lastbuyprice_withTax = 435, meanbuyprice_withTax = 435, lastbuyprice_withDiscountAndTax = 435
                where sellbilldetailid = 5342;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2400, '2026-10-22', 1395, 1305, 1305
                    , 1305, 1305, 1305, 1305
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1305, 1305, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1305
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1305, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1305, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1305
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1305
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1305
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1395, 1305, 1305
                    , 1305, 1305, 1305, 1305
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1305, 1305, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1395, sellCostBuyPrice =sellCostBuyPrice+1305
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1305, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1305
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1305, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1305
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1305
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1305
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1305
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3795';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2400', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '2', '2026-10-22 15:33:41','0','0'); -- id=16950
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7070;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01793', '1336', '138', '1793', '3', '455', '1365', '0', '', '0', '2026-10-22 15:33:41', '1793', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7070-3,','1','1','0','0','455','1365','0','','0','0.00','0','0','0','0'); -- id=5343
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5343;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1793, '2026-10-22', 1365, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1365, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1365, 1275, 1275
                    , 1275, 1275, 1275, 1275
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1275, 1275, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1365, sellCostBuyPrice =sellCostBuyPrice+1275
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1275, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1275
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1275, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1275
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1275
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1275
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1275
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '9', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '2806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1793', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '9', '2', '2026-10-22 15:33:41','0','0'); -- id=16951
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6138;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02087', '1336', '174', '2087', '3', '430', '1290', '0', '', '0', '2026-10-22 15:33:41', '2087', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6138-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=5344
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5344;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2087, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1290, 1290, 1290
                    , 1290, 1161, 1161, 1161
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1290, 1290, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1290, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1290
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1161, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1161
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1161
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1290
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1290
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '97', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '3446';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2087', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '100', '97', '2', '2026-10-22 15:33:41','0','0'); -- id=16952
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','i0001886', '1336', '147', '1886', '3', '320', '960', '0', '', '0', '2026-10-22 15:33:41', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6989-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5345
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5345;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 960, 867, 867
                    , 867, 867, 867, 867
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 867, 867, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+867
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+867, sellCostMeanBuyPrice = sellCostMeanBuyPrice+867
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+867, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+867
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+867
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+867
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+867
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 867, 867
                    , 867, 867, 867, 867
                    , 0, 0, 0, 0
                    , 0, 0, 0, 867, 867, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+867
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+867, sellCostMeanBuyPrice = sellCostMeanBuyPrice+867
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+867, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+867
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+867
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+867
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+867
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '61', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '3', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '64', '61', '2', '2026-10-22 15:33:41','0','0'); -- id=16953
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1336', '153', '1921', '6', '485', '2910', '0', '', '0', '2026-10-22 15:33:41', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-6,','1','1','0','0','485','2910','0','','0','0.00','0','0','0','0'); -- id=5346
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5346;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 2910, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2910, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2910, 2760, 2760
                    , 2760, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2760, 2760, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2910, sellCostBuyPrice =sellCostBuyPrice+2760
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2760, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2760
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2760
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2760
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 15:33:41' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '6', '1', '1336', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '0', '2', '2026-10-22 15:33:41','0','0'); -- id=16954
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8612821',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8582241','30580', '0', '2', 'اضافة فاتورة مبيعات', '1336', '8612821', '2026-10-22 15:33:41', '2',  'sellbillController.php','1','','0'); -- id=1642
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30580', '30580', '2026-10-22', '2', '0', '0', '2026-10-22 15:33:41','اضافة فاتورة مبيعات رقم 1336','1','0',null,'0','1336','sellbillController.php?do=showDetail&sellbillid=1336'); -- id=4585
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4585', '419', '30580', '','0'); -- id=4715
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8612820.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4585', '143', '30580', '','0'); -- id=4587
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15207340', 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 ( '28387.1', '28387.1', '2026-10-22', '2', '0', '0', '2026-10-22 15:33:41','اضافة فاتورة مبيعات رقم 1336 - صرف البضاعة من المخزن','1','0',null,'0','1336','sellbillController.php?do=showDetail&sellbillid=1336'); -- id=4586
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4586', '402', '28387.1', '','0'); -- id=4716
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14069046.21', 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 ('4586', '382', '28387.1', '','0'); -- id=4588
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27061982.99', 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='4585,0,4586' where sellbillid=1336;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 30580, 29432, 29447
                    , 29439.5, 28387.1, 28457.57, 28387.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29439.5, 25293.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30580, sellCostBuyPrice =sellCostBuyPrice+29432
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29447, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29439.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28387.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28457.57
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28387.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29439.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+25293.58
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 30580, 29432, 29447
                    , 29439.5, 28387.1, 28457.57, 28387.1
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29439.5, 25293.58, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30580, sellCostBuyPrice =sellCostBuyPrice+29432
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29447, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29439.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28387.1, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28457.57
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28387.1
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29439.5
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+25293.58
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 30580, 29432, 29447
                    , 29439.5, 28387.1, 28457.57, 28387.1, 29439.5, 25293.58)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+30580, netSellCostBuyPrice = netSellCostBuyPrice+29432
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+29447
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+29439.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+28387.1
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+28457.57
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+28387.1
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+29439.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+25293.58;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada002a391fc and sellbillId = 1336 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:33:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:33:41', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18550
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:03:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:33:46", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:33:46', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18551
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:13', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18552

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada01b579030
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada01b579030 and sellbillId = 1337 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:14", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:14', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18553
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18554
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18555
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:41", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:41', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18556

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada02aaacddb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada02aaacddb and sellbillId = 1338 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:04:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:34:41", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:34:41', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18557
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:07:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:37:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:37:54', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18558
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:07:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:37:57", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:37:57', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18559
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:02", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:38:02', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18560
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:38:04', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18561
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:38:05', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18562
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:38:34', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18563
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:39", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:38:39', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18564
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:40";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:38:41', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18565
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:38:45', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18566
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:45";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:38:45', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18567
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:08:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:38:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:38:54', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18568
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:10:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:40:16", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:40:16', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18569
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:10:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:40:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:40:51', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18570
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:41:05', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18571
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:22", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:41:22', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18572
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:55", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:41:55', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18573
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:56";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:41:56', '3', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18574
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:58", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:41:58', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18575
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:41:58', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18576
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:41:59', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18577
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:11:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:41:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:41:59', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18578
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:12:00";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:42:00', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18579
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:12:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:42:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:42:02', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18580
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:13:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:43:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:43:44', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18581
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:14:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:44:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:44:36', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18582
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:14:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:44:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:44:45', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18583

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0500f34da
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 15:44:45', '06ada0500f34da', '1', '0.00', '0', '0', '1', '1045', '1045', '-1045', '0', '1', '2026-10-22 15:44:45', '', '2', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '3', '0', '', '','','','-1','0','0','0','','0','-1045','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=46
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','46', '0', '2026-10-22 15:44:45', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '1045', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 15:44:45','0','0','',''); -- id=1571
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('320.00', '01378', '46', '94', '1378', '1', '360', '360', '0', '', '0', '0', '1378', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','360','360','0','','0'); -- id=66
UPDATE returnsellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where returnsellbilldetailid = 66;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320, 0, 1, 0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320, 0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320;
UPDATE storedetail SET  productquantity = '392', userid = '2', storedetaildate = '2026-10-22 15:44:45' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '1', '0', '46', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '391', '392', '2', '2026-10-22 15:44:45','0','0'); -- id=16957
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('350.00', '01380', '46', '94', '1380', '1', '390', '390', '0', '', '0', '0', '1380', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','390','390','0','','0'); -- id=67
UPDATE returnsellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where returnsellbilldetailid = 67;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1380, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 390, 350, 350, 350
                    , 350, 350, 350, 0, 1, 0, 0, 350, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+390, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+350
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 390, 350, 350, 350
                    , 350, 350, 350, 0, 0, 350, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+390, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+350
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+350
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+350
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350;
UPDATE storedetail SET  productquantity = '383', userid = '2', storedetaildate = '2026-10-22 15:44:45' WHERE storedetailid = '1380';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1380', '1', '1', '0', '46', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '382', '383', '2', '2026-10-22 15:44:45','0','0'); -- id=16958
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('260.00', '01381', '46', '94', '1381', '1', '295', '295', '0', '', '0', '0', '1381', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','295','295','0','','0'); -- id=68
UPDATE returnsellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where returnsellbilldetailid = 68;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1381, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 295, 260, 260, 260
                    , 260, 260, 260, 0, 1, 0, 0, 260, 260)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+295, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+260
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+260
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+260
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 295, 260, 260, 260
                    , 260, 260, 260, 0, 0, 260, 260)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+295, returnSellCostBuyPrice = returnSellCostBuyPrice+260, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+260
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+260, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+260
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+260
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+260
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+260
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+260;
UPDATE storedetail SET  productquantity = '97', userid = '2', storedetaildate = '2026-10-22 15:44:45' WHERE storedetailid = '1381';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1381', '1', '1', '0', '46', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '96', '97', '2', '2026-10-22 15:44:45','0','0'); -- id=16959
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8611776',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8612821','-1045', '1', '2', 'اضافة فاتورة مردوات مبيعات', '46', '8611776', '2026-10-22 15:44:45', '2',  'returnsellbillController.php','1','','0'); -- id=1645
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1045', '1045', '2026-10-22', '2', '0', '0', '2026-10-22 15:44:45','اضافة فاتورة مردود مبيعات رقم 46','1','0',null,'0','46','returnsellbillController.php?do=showDetail&returnsellbillid=46'); -- id=4591
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4591', '143', '1045', '','0'); -- id=4721
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15210695', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4591', '419', '1045', '','0'); -- id=4593
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8611775.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '930', '930', '2026-10-22', '2', '0', '0', '2026-10-22 15:44:45','اضافة فاتورة مردود مبيعات رقم 46 - صرف البضاعة من المخزن','1','0',null,'0','46','returnsellbillController.php?do=showDetail&returnsellbillid=46'); -- id=4592
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4592', '382', '930', '','0'); -- id=4722
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27060392.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4592', '402', '930', '','0'); -- id=4594
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14072236.21', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4591,0,4592' where returnsellbillid=46;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1045, 930, 930, 930
                    , 930, 930, 930 ,0, 0, 930, 930)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1045, returnSellCostBuyPrice = returnSellCostBuyPrice+930, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+930
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+930, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+930
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+930
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+930
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+930
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+930;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 1045, 930, 930, 930
                    , 930, 930, 930 ,0, 0, 930, 930)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+1045, returnSellCostBuyPrice = returnSellCostBuyPrice+930, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+930
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+930, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+930
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+930
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+930
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+930
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+930;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -1045, -930, -930
                    , -930, -930, -930, -930, -930, -930)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-1045, netSellCostBuyPrice = netSellCostBuyPrice+-930
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-930
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-930
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-930
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-930
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-930
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-930
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-930;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0500f34da and sellbillId = 46 and returnsellbillId = 46
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:14:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:44:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:44:45', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18584
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:45:00', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18585
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:15", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:45:15', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18586
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:20";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:45:24', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18587
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:24";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:45:24', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18588
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:45:27', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18589

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada055b738c8
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 15:45:27', '06ada055b738c8', '1', '0.00', '0', '0', '1', '360', '360', '-360', '0', '1', '2026-10-22 15:45:27', '', '2', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-360','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=47
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','47', '0', '2026-10-22 15:45:27', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '360', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 15:45:27','0','0','',''); -- id=1572
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('320.00', '01378', '47', '94', '1378', '1', '360', '360', '0', '', '0', '0', '1378', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','360','360','0','','0'); -- id=69
UPDATE returnsellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where returnsellbilldetailid = 69;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320, 0, 1, 0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320, 0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320;
UPDATE storedetail SET  productquantity = '393', userid = '2', storedetaildate = '2026-10-22 15:45:27' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '1', '0', '47', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '392', '393', '2', '2026-10-22 15:45:27','0','0'); -- id=16960
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8611416',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8611776','-360', '1', '2', 'اضافة فاتورة مردوات مبيعات', '47', '8611416', '2026-10-22 15:45:27', '2',  'returnsellbillController.php','1','','0'); -- id=1646
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '360', '360', '2026-10-22', '2', '0', '0', '2026-10-22 15:45:27','اضافة فاتورة مردود مبيعات رقم 47','1','0',null,'0','47','returnsellbillController.php?do=showDetail&returnsellbillid=47'); -- id=4593
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4593', '143', '360', '','0'); -- id=4723
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15210335', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4593', '419', '360', '','0'); -- id=4595
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8611415.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '320', '320', '2026-10-22', '2', '0', '0', '2026-10-22 15:45:27','اضافة فاتورة مردود مبيعات رقم 47 - صرف البضاعة من المخزن','1','0',null,'0','47','returnsellbillController.php?do=showDetail&returnsellbillid=47'); -- id=4594
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4594', '382', '320', '','0'); -- id=4724
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27060712.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4594', '402', '320', '','0'); -- id=4596
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14071916.21', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4593,0,4594' where returnsellbillid=47;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320 ,0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 360, 320, 320, 320
                    , 320, 320, 320 ,0, 0, 320, 320)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+360, returnSellCostBuyPrice = returnSellCostBuyPrice+320, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+320
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+320, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+320
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+320
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+320
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+320
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+320;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -360, -320, -320
                    , -320, -320, -320, -320, -320, -320)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-360, netSellCostBuyPrice = netSellCostBuyPrice+-320
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-320
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-320
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-320
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-320
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-320
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-320
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-320;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada055b738c8 and sellbillId = 47 and returnsellbillId = 47
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:45:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18590
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:15:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:45:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:45:34', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18591
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:16:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:46:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 15:46:02', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=18592
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:16:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:46:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 15:46:14', '7', 'autosave', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=18593
UPDATE storedetail SET  productquantity = '3', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '1', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '2', '3', '7', '2026-10-22','0','0'); -- id=16961
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '360', '360', '2026-10-22', '7', '0', '0', '2026-10-22 15:46:14','اعادة جرد للمنتج : (موديلات زنط الكاشف/احمد الكاشف) فى مخزن : (المخزن الرئيسي) بالكمية : 3','1','0',null,'0','16961','inventoryController.php?do=details&id=16961'); -- id=4595
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4595', '382', '360', '','0'); -- id=4725
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27061072.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4595', '188', '360', '','0'); -- id=4597
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3248880', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:16:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:46:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:46:48', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18594

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada056e6cdd9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada056e6cdd9 and sellbillId = 1339 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:16:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:46:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:46:48', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18595
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:17:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:47:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:47:46', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18596

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada02ce9b89f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 15:47:46', '06ada02ce9b89f', '1', '0.00', '0', '0', '1', '10665.00', '10665', '10665', '0', '1', '2026-10-22 15:47:46', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '27' ,'0','','','','','-1','0','0','0','0','0','10665','0','','0','0','10665','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1340
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1340', '0', '2026-10-22 15:47:46', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10665', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 15:47:46','0','0','',''); -- id=1574
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 985;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('364','01891', '1340', '147', '1891', '6', '395', '2370', '0', '', '0', '2026-10-22 15:47:46', '1891', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','985-6,','1','1','0','0','395','2370','0','','0','0.00','0','0','0','0'); -- id=5350
UPDATE sellbilldetail SET  lastbuyprice = 364.00 , meanbuyprice = 364.00, lastbuyprice_withDiscount = 364.00, meanbuyprice_withDiscount = 364.00
        , lastbuyprice_withTax = 364, meanbuyprice_withTax = 364, lastbuyprice_withDiscountAndTax = 364
                where sellbilldetailid = 5350;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1891, '2026-10-22', 2370, 2184, 2184
                    , 2184, 2184, 2184, 2184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2184, 2184, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2370, sellCostBuyPrice =sellCostBuyPrice+2184
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2184, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2184
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2184
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2184
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2370, 2184, 2184
                    , 2184, 2184, 2184, 2184
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2184, 2184, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2370, sellCostBuyPrice =sellCostBuyPrice+2184
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2184, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2184
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2184, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2184
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2184
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2184
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2184
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '192', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '2908';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1891', '1', '6', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '198', '192', '3', '2026-10-22 15:47:46','0','0'); -- id=16963
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '1340', '94', '1378', '3', '360', '1080', '0', '', '0', '2026-10-22 15:47:46', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=5351
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5351;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '390', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '3', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '393', '390', '3', '2026-10-22 15:47:46','0','0'); -- id=16964
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1340', '147', '1887', '6', '410', '2460', '0', '', '0', '2026-10-22 15:47:46', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-6,','1','1','0','0','410','2460','0','','0','0.00','0','0','0','0'); -- id=5352
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 5352;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 2460, 2274, 2274
                    , 2274, 2274, 2274, 2274
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2274, 2274, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2274
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2274, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2274
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2274, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2274
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2274
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2274
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2274
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2460, 2274, 2274
                    , 2274, 2274, 2274, 2274
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2274, 2274, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2460, sellCostBuyPrice =sellCostBuyPrice+2274
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2274, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2274
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2274, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2274
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2274
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2274
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2274
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '261', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '6', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '267', '261', '3', '2026-10-22 15:47:46','0','0'); -- id=16965
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 985;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('364','01891', '1340', '147', '1891', '3', '395', '1185', '0', '', '0', '2026-10-22 15:47:46', '1891', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','985-3,','1','1','0','0','395','1185','0','','0','0.00','0','0','0','0'); -- id=5353
UPDATE sellbilldetail SET  lastbuyprice = 364.00 , meanbuyprice = 364.00, lastbuyprice_withDiscount = 364.00, meanbuyprice_withDiscount = 364.00
        , lastbuyprice_withTax = 364, meanbuyprice_withTax = 364, lastbuyprice_withDiscountAndTax = 364
                where sellbilldetailid = 5353;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1891, '2026-10-22', 1185, 1092, 1092
                    , 1092, 1092, 1092, 1092
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1092, 1092, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1185, sellCostBuyPrice =sellCostBuyPrice+1092
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1092, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1092
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1092, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1092
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1092
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1092
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1092
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1185, 1092, 1092
                    , 1092, 1092, 1092, 1092
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1092, 1092, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1185, sellCostBuyPrice =sellCostBuyPrice+1092
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1092, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1092
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1092, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1092
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1092
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1092
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1092
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '189', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '2908';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1891', '1', '3', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '192', '189', '3', '2026-10-22 15:47:46','0','0'); -- id=16966
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 70;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01378', '1340', '94', '1378', '3', '360', '1080', '0', '', '0', '2026-10-22 15:47:46', '1378', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','70-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=5354
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5354;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1378, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1080, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '387', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '1378';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1378', '1', '3', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '390', '387', '3', '2026-10-22 15:47:46','0','0'); -- id=16967
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 332;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '1340', '103', '1462', '3', '430', '1290', '0', '', '0', '2026-10-22 15:47:46', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-3,','1','1','0','0','430','1290','0','','0','0.00','0','0','0','0'); -- id=5355
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5355;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-22', 1290, 1230, 1230
                    , 1230, 1230, 1230, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1290, 1230, 1230
                    , 1230, 1230, 1230, 1230
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1230, 1230, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1290, sellCostBuyPrice =sellCostBuyPrice+1230
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1230, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1230
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1230, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1230
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1230
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1230
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1230
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '186', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '3', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '189', '186', '3', '2026-10-22 15:47:46','0','0'); -- id=16968
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01382', '1340', '94', '1382', '3', '400', '1200', '0', '', '0', '2026-10-22 15:47:46', '1382', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5356
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5356;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1382, '2026-10-22', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1080, 1080
                    , 1080, 1080, 1080, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1080
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '3', storedetaildate = '2026-10-22 15:47:46' WHERE storedetailid = '1382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1382', '1', '3', '1', '1340', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '3', '2026-10-22 15:47:46','0','0'); -- id=16969
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8624421',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8613756','10665', '0', '2', 'اضافة فاتورة مبيعات', '1340', '8624421', '2026-10-22 15:47:46', '3',  'sellbillController.php','1','','0'); -- id=1648
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10665', '10665', '2026-10-22', '3', '0', '0', '2026-10-22 15:47:46','اضافة فاتورة مبيعات رقم 1340','1','0',null,'0','1340','sellbillController.php?do=showDetail&sellbillid=1340'); -- id=4598
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4598', '419', '10665', '','0'); -- id=4728
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8624420.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4598', '143', '10665', '','0'); -- id=4600
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15223340', 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 ( '9780', '9780', '2026-10-22', '3', '0', '0', '2026-10-22 15:47:46','اضافة فاتورة مبيعات رقم 1340 - صرف البضاعة من المخزن','1','0',null,'0','1340','sellbillController.php?do=showDetail&sellbillid=1340'); -- id=4599
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4599', '402', '9780', '','0'); -- id=4729
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14083850.21', 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 ('4599', '382', '9780', '','0'); -- id=4601
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27049138.99', 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='4598,0,4599' where sellbillid=1340;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10665, 9780, 9780
                    , 9780, 9780, 9780, 9780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9780, 9780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10665, sellCostBuyPrice =sellCostBuyPrice+9780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10665, 9780, 9780
                    , 9780, 9780, 9780, 9780
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,9780, 9780, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10665, sellCostBuyPrice =sellCostBuyPrice+9780
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9780, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9780
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9780, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9780
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9780
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9780
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9780
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10665, 9780, 9780
                    , 9780, 9780, 9780, 9780, 9780, 9780)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10665, netSellCostBuyPrice = netSellCostBuyPrice+9780
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+9780
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+9780
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9780
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9780
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9780
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+9780
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9780;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada02ce9b89f and sellbillId = 1340 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:17:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:47:46", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:47:46', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18597
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:18:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:48:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:48:34', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18598
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:18:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:48:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:48:34', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18599
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:21:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:51:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:51:17', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18600
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:21:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:51:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:51:34', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18601
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:21:34";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 15:51:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:51:34', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18602
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:21:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:51:36", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:51:36', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18603
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:21:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:51:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:51:48', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18604
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 15:52:02', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=18605
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:52:11', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18606

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada05b8a885b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 15:52:11', '06ada05b8a885b', '1', '0.00', '0', '0', '1', '16730.00', '16730', '16730', '0', '1', '2026-10-22 15:52:11', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '49' ,'0','','','','','-1','0','0','0','0','0','16730','0','','0','0','16730','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1341
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1341', '0', '2026-10-22 15:52:11', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '16730', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 15:52:11','0','0','',''); -- id=1575
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 6757;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('322','02272', '1341', '71', '2272', '8', '350', '2800', '0', '', '0', '2026-10-22 15:52:11', '2272', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6757-8,','1','1','0','0','350','2800','0','','0','0.00','0','0','0','0'); -- id=5357
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 322.00, meanbuyprice_withDiscount = 322.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 322
                where sellbilldetailid = 5357;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2272, '2026-10-22', 2800, 2800, 2800
                    , 2800, 2576, 2576, 2576
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2576, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2576
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2576
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2800, 2800, 2800
                    , 2800, 2576, 2576, 2576
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2800, 2800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2800, sellCostBuyPrice =sellCostBuyPrice+2800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2576, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2576
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2576
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '3665';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2272', '1', '8', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '48', '2', '2026-10-22 15:52:11','0','0'); -- id=16970
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 959;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('328.5','01881', '1341', '75', '1881', '6', '365', '2190', '0', '', '0', '2026-10-22 15:52:11', '1881', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','959-6,','1','1','0','0','365','2190','0','','0','0.00','0','0','0','0'); -- id=5358
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 328.50, meanbuyprice_withDiscount = 346.75
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 182.5, lastbuyprice_withDiscountAndTax = 328.5
                where sellbilldetailid = 5358;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1881, '2026-10-22', 2190, 2190, 2190
                    , 2190, 1971, 2080.5, 1971
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2190, 1095, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1971, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2080.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1971
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1095
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2190, 2190, 2190
                    , 2190, 1971, 2080.5, 1971
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2190, 1095, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2190, sellCostBuyPrice =sellCostBuyPrice+2190
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2190, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2190
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1971, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2080.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1971
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2190
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1095
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '2898';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1881', '1', '6', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '48', '2', '2026-10-22 15:52:11','0','0'); -- id=16971
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 955;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','01877', '1341', '75', '1877', '6', '360', '2160', '0', '', '0', '2026-10-22 15:52:11', '1877', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','955-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5359
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 342.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 180, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 5359;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1877, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 2052, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2052
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1944, 2052, 1944
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1944, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2052
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1944
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '2894';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1877', '1', '6', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 15:52:11','0','0'); -- id=16972
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6536;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01973', '1341', '59', '1973', '9', '340', '3060', '0', '', '0', '2026-10-22 15:52:11', '1973', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6536-9,','1','1','0','0','340','3060','0','','0','0.00','0','0','0','0'); -- id=5360
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 327.74, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 327.74
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 327.74, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 5360;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1973, '2026-10-22', 3060, 2970, 2970
                    , 2949.66, 2970, 2949.66, 2939.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2970, 2949.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2970
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2970, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2949.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2949.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2939.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2970
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2949.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3060, 2970, 2970
                    , 2949.66, 2970, 2949.66, 2939.31
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2970, 2949.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3060, sellCostBuyPrice =sellCostBuyPrice+2970
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2970, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2949.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2970, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2949.66
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2939.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2970
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2949.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '72', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '2990';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1973', '1', '9', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '81', '72', '2', '2026-10-22 15:52:11','0','0'); -- id=16973
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 952;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01459', '1341', '103', '1459', '6', '330', '1980', '0', '', '0', '2026-10-22 15:52:11', '1459', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','952-6,','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=5361
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5361;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1459, '2026-10-22', 1980, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1980, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '43', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '1484';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1459', '1', '6', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '43', '2', '2026-10-22 15:52:11','0','0'); -- id=16974
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7099;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02425', '1341', '190', '2425', '8', '320', '2560', '0', '', '0', '2026-10-22 15:52:11', '2425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7099-8,','1','1','0','0','320','2560','0','','0','0.00','0','0','0','0'); -- id=5362
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5362;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2425, '2026-10-22', 2560, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2560, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '8', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '28', '2', '2026-10-22 15:52:11','0','0'); -- id=16975
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1341', '190', '2176', '6', '330', '1980', '0', '', '0', '2026-10-22 15:52:11', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-6,','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=5363
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5363;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 1980, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1980, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1980, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '68', userid = '2', storedetaildate = '2026-10-22 15:52:11' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '6', '1', '1341', 'اضافة فاتورة مبيعات', 'sellbillController.php', '74', '68', '2', '2026-10-22 15:52:11','0','0'); -- id=16976
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8641151',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8624421','16730', '0', '2', 'اضافة فاتورة مبيعات', '1341', '8641151', '2026-10-22 15:52:11', '2',  'sellbillController.php','1','','0'); -- id=1649
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '16730', '16730', '2026-10-22', '2', '0', '0', '2026-10-22 15:52:11','اضافة فاتورة مبيعات رقم 1341','1','0',null,'0','1341','sellbillController.php?do=showDetail&sellbillid=1341'); -- id=4600
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4600', '419', '16730', '','0'); -- id=4730
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8641150.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4600', '143', '16730', '','0'); -- id=4602
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15240070', 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 ( '15581', '15581', '2026-10-22', '2', '0', '0', '2026-10-22 15:52:11','اضافة فاتورة مبيعات رقم 1341 - صرف البضاعة من المخزن','1','0',null,'0','1341','sellbillController.php?do=showDetail&sellbillid=1341'); -- id=4601
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4601', '402', '15581', '','0'); -- id=4731
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14099431.21', 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 ('4601', '382', '15581', '','0'); -- id=4603
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27033557.99', 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='4600,0,4601' where sellbillid=1341;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 16730, 16240, 16240
                    , 16219.66, 15581, 15778.16, 15550.31
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16240, 14044.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16730, sellCostBuyPrice =sellCostBuyPrice+16240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16219.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15581, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15778.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15550.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14044.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 16730, 16240, 16240
                    , 16219.66, 15581, 15778.16, 15550.31
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16240, 14044.66, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+16730, sellCostBuyPrice =sellCostBuyPrice+16240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16219.66
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+15581, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+15778.16
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+15550.31
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14044.66
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 16730, 16240, 16240
                    , 16219.66, 15581, 15778.16, 15550.31, 16240, 14044.66)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+16730, netSellCostBuyPrice = netSellCostBuyPrice+16240
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+16240
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+16219.66
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+15581
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+15778.16
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+15550.31
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+16240
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+14044.66;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada05b8a885b and sellbillId = 1341 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:52:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18607
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:16", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 15:52:16', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18608
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:52:21', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18609
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:52:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18610
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:47", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:52:47', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18611
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:52:48', '7', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18612
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:22:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:52:58", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:52:58', '7', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18613
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:23:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:53:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:53:00', '7', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=241'); -- id=18614
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:23:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:53:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 15:53:18', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=18615
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:23:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:53:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 15:53:28', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18616
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:54:00', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18617
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 ('06ada07051b310', '2026-10-22 15:52:21', '110', '42084.00', '59634', '10', '1', '19500.00',  '17550.00', '0', '17550', '1', '2026-10-22 15:54:00', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=343
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 ('01581', '343', '114', '1581', '30', '650', '19500.00', '0', '', '2026-10-22 15:54:00', '1581','','','0','0','0','0','0',null,'650','19500','0','0','0','0','0','0','0','0','1'); -- id=1821
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 15:52:21', 1, 1581, 0, 0
                    , 585, 30, 0, 0, 5, '2026-10-22 15:54:00')
                ON DUPLICATE KEY UPDATE buyprice = 585,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 15:54:00' ; -- id=7147
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1581', '650', '30', '0', 'buyBillController.php', '1821', '', '0', '0'); -- id=1367
UPDATE product SET  productBuyPrice = "650" WHERE productId = 1581 ;
UPDATE buybilldetail SET  quantitybefore = 16 WHERE buybilldetailid = 1821 ;
UPDATE product SET productName = 'جاكيت جلد ماجيك مان', productDescription = '', productCatId = '114', productBuyPrice = '650.00', productSellAllPrice = '650.00', productSellUnitPrice = '650.00', productSellHalfPrice = '650.00', productDate = '2026-10-07', conditions = '0', userId = '1', limitamount = '0', parcode = '01581',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '650',lastbuyprice_withDiscount = '585',meanbuyprice = '650',meanbuyprice_withDiscount = '585' , productbuypricereal = '650.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='585',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='650',meanbuyprice_withTax='650',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='585',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1581';
UPDATE buybilldetail SET  lastbuyprice = 650 , meanbuyprice = 650, lastbuyprice_withDiscount = 585, meanbuyprice_withDiscount = 585
        , lastbuyprice_withTax = 650, meanbuyprice_withTax = 650, lastbuyprice_withDiscountAndTax = 585
                where buybilldetailid = 1821;
UPDATE productunit SET proUnitBuyPrice  = 650 * productnumber WHERE productid = 1581;
UPDATE storedetail SET  productquantity = '46', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '1606';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1581', '1', '30', '0', '343', 'اضافة فاتورة مشتريات', 'buyBillController.php', '16', '46', '5', '2026-10-22 15:52:21','0','0'); -- id=16977
UPDATE supplier SET  suppliercurrentDebt = '59634',suppliercurrentDebtInCurrency= '59634' , userid = '5', supplierdate = '2026-10-22 15:54:00'   WHERE supplierid = '110';
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 ('110', '42084.00', '17550', '0', 'اضافة فاتورة مشتريات', '343', '59634', '2026-10-22 15:52:21', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','17550','1','42084','17550','59634','0',''); -- id=893
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17550', '17550', '2026-10-22', '5', '0', '0', '2026-10-22 15:54:00','اضافة فاتورة مشتريات رقم 343','1','0',null,'0','343','buyBillController.php?do=details&id=343'); -- id=4602
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4602', '382', '17550', '','0'); -- id=4732
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27051107.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4602', '593', '17550', '','0'); -- id=4604
UPDATE accountstree SET name = 'ماجيك مان', customName = 'ماجيك مان', customNameEn = 'ماجيك مان', nameEn = 'ماجيك مان', parent = '81', accountNature = '1', theValue = '59634', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 14:54:42' WHERE id = '593';
update buybill set dailyentryid='4602,0' where buybillid=343;
COMMIT;
UPDATE product SET overAllAveragePrice = 585 WHERE productId = 1581;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:00", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:54:00', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=343'); -- id=18618
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:54:02', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=343&type=2'); -- id=18619
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:54:25', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18620

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada071f447b6
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada071f447b6 and sellbillId = 1342 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:54:25', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18621
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:54:38', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=343&type=2'); -- id=18622
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:24:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:54:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:54:41', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18623
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:25:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:55:27", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:55:27', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18624
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:26:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:56:00", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:56:00', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18625
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:57:09', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18626

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada07e103314
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada07e103314 and sellbillId = 1343 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 15:57:09', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18627
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:57:55', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18628
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:57:57', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=343&type=2'); -- id=18629
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:57:58', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=343'); -- id=18630
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 15:57:58', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18631
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 15:57:59', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18632
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:27:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:57:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:57:59', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18633
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:28:00";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:58:00', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18634
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:28:58";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:01", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 15:59:01', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18635
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:01";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 15:59:01', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18636
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:08", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:59:08', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18637
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:12", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:59:12', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18638
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:20", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 15:59:20', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18639
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:34", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:59:34', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18640
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:35", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:59:35', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18641
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:29:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 15:59:52", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 15:59:52', '3', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=18642
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:30:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:00:09", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:00:09', '3', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=18643
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:30:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:00:19", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:00:19', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18644

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada02e172817
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada02e172817 and sellbillId = 1344 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:30:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:00:19", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:00:19', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18645
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:31:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:01:38", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:01:38', '3', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=18646
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:32:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:02:02", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:02:02', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18647
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:32:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:02:03", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:02:03', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18648
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:33:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:03:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:03:57', '5', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18649
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:34:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:04:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:04:18', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18650
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:34:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:04:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:04:53', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=334'); -- id=18651
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:35:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:05:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:05:23', '5', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=18652
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 334;
UPDATE buybill SET  buybillsysdate = '2026-10-22 16:05:23', userid = '5',delbyuserid = '5', conditions = '1' WHERE buybillid = '334';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 12:12:02', 1, 1696, 0, 0
                    , 450, 150, 0, 0, 5, '2026-10-22 16:05:23')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-150, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:05:23' ; -- id=7113
UPDATE product SET productName = 'شروال الاسد', productDescription = '', productCatId = '129', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01696',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1696';
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1696;
UPDATE storedetail SET  productquantity = '69', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '2708';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '1', '150', '1', '334', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '219', '69', '5', '2026-10-22 12:12:02','0','0'); -- id=16984
UPDATE supplier SET  suppliercurrentDebt = '107820',suppliercurrentDebtInCurrency= '104670' , userid = '5', supplierdate = '2026-10-22 16:05: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', '168570.00', '60750.00', '1', 'حذف فاتورة مشتريات - للتعديل', '334', '107820', '2026-10-22 12:12:02', '5', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','60750','1','165420','60750','104670','0',''); -- id=894
UPDATE productserial SET del = 1
		 WHERE billid = 334;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ad9d36220344', '2026-10-22 12:12:02', '124', '174250.00', '235000', '10', '1', '67500.00', '60750.00', '0.00', '60750', '1', '2026-10-22 16:05:23', '', '5', '0', '', '1', '1','1','334','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=344
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 ('01696', '344', '129', '1696', '150.00', '450', '67500.00', '0.00', '', '2026-10-22 16:05:23', '1696','','','0','0','0','0','0',null,'450','67500','0','0','0','0','0','0','0','0','1'); -- id=1822
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 12:12:02', 1, 1696, 0, 0
                    , 405, 150, 0, 0, 5, '2026-10-22 16:05:23')
                ON DUPLICATE KEY UPDATE buyprice = 405,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:05:23' ; -- id=7113
UPDATE product SET  productBuyPrice = "450" WHERE productId = 1696 ;
UPDATE buybilldetail SET  quantitybefore = 69 WHERE buybilldetailid = 1822 ;
UPDATE product SET productName = 'شروال الاسد', productDescription = '', productCatId = '129', productBuyPrice = '450.00', productSellAllPrice = '450.00', productSellUnitPrice = '450.00', productSellHalfPrice = '450.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01696',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '405',meanbuyprice = '450',meanbuyprice_withDiscount = '405' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='405',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='450',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='405',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1696';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 405, meanbuyprice_withDiscount = 405
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where buybilldetailid = 1822;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 1696;
UPDATE storedetail SET  productquantity = '219', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '2708';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1696', '1', '150', '0', '344', 'اضافة فاتورة مشتريات', 'buyBillController.php', '69', '219', '5', '2026-10-22 12:12:02','0','0'); -- id=16985
DELETE FROM productserial WHERE billid = 334
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '235000',suppliercurrentDebtInCurrency= '235000' , userid = '5', supplierdate = '2026-10-22 16:05:23'   WHERE supplierid = '124';
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 ('124', '174250.00', '60750', '0', 'اضافة فاتورة مشتريات', '344', '235000', '2026-10-22 16:05:23', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','60750','1','174250','60750','235000','0',''); -- id=895
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '60750', '60750', '2026-10-22', '5', '0', '0', '2026-10-22 16:05:23','اضافة فاتورة مشتريات رقم 344','1','0',null,'0','344','buyBillController.php?do=details&id=344'); -- id=4609
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4609', '382', '60750', '','0'); -- id=4739
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27104307.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4609', '607', '60750', '','0'); -- id=4611
UPDATE accountstree SET name = 'الاسد', customName = 'الاسد', customNameEn = 'الاسد', nameEn = 'الاسد', parent = '81', accountNature = '1', theValue = '235000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 12:23:57' WHERE id = '607';
update buybill set dailyentryid='4609,0' where buybillid=344;
UPDATE product SET overAllAveragePrice = 405 WHERE productId = 1696;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:35:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:05:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:05:24', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=344'); -- id=18653
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:35:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:05:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:05:32', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=334'); -- id=18654
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:35:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:05:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:05:33', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18655
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:35:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:05:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:05:57', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=333'); -- id=18656
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:36:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:06:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:06:06', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18657
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:36:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:06:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:06:54', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18658
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:36:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:06:54", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:06:54', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18659
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:07:12", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:07:12', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18660
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:39";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:07:40", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:07:40', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18661

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0a8098008
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 16:07:40', '06ada0a8098008', '1', '0.00', '0', '0', '1', '700', '700', '-700', '0', '1', '2026-10-22 16:07:40', '', '6', '0', 'نقدي','4', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-700','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=48
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','48', '0', '2026-10-22 16:07:40', '6', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '700', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 16:07:40','0','0','',''); -- id=1579
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('700.00', '01736', '48', '133', '1736', '1', '700', '700', '0', '', '0', '0', '1736', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','700','700','0','','0'); -- id=70
UPDATE returnsellbilldetail SET  lastbuyprice = 700.00 , meanbuyprice = 700.00, lastbuyprice_withDiscount = 700.00, meanbuyprice_withDiscount = 700.00
        , lastbuyprice_withTax = 700, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 700
                where returnsellbilldetailid = 70;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1736, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 700, 700, 700, 700
                    , 700, 700, 700, 0, 1, 0, 0, 700, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+700, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+700
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+700
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 700, 700, 700, 700
                    , 700, 700, 700, 0, 0, 700, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+700, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+700
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+700
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350;
UPDATE storedetail SET  productquantity = '17', userid = '6', storedetaildate = '2026-10-22 16:07:40' WHERE storedetailid = '2749';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1736', '1', '1', '0', '48', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '16', '17', '6', '2026-10-22 16:07:40','0','0'); -- id=16986
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1332720',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1333420','-700', '1', '4', 'اضافة فاتورة مردوات مبيعات', '48', '1332720', '2026-10-22 16:07:40', '6',  'returnsellbillController.php','1','','0'); -- id=1653
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '700', '700', '2026-10-22', '6', '0', '0', '2026-10-22 16:07:40','اضافة فاتورة مردود مبيعات رقم 48','1','0',null,'0','48','returnsellbillController.php?do=showDetail&returnsellbillid=48'); -- id=4610
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4610', '143', '700', '','0'); -- id=4740
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15249460', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4610', '568', '700', '','0'); -- id=4612
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1332720', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '700', '700', '2026-10-22', '6', '0', '0', '2026-10-22 16:07:40','اضافة فاتورة مردود مبيعات رقم 48 - صرف البضاعة من المخزن','1','0',null,'0','48','returnsellbillController.php?do=showDetail&returnsellbillid=48'); -- id=4611
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4611', '382', '700', '','0'); -- id=4741
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27105007.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4611', '402', '700', '','0'); -- id=4613
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14107721.21', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4610,0,4611' where returnsellbillid=48;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 700, 700, 700, 700
                    , 700, 700, 700 ,0, 0, 700, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+700, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+700
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+700
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 700, 700, 700, 700
                    , 700, 700, 700 ,0, 0, 700, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+700, returnSellCostBuyPrice = returnSellCostBuyPrice+700, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+700
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+700, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+700
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+700
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+700
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+700
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -700, -700, -700
                    , -700, -700, -700, -700, -700, -350)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-700, netSellCostBuyPrice = netSellCostBuyPrice+-700
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-700
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-700
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-700
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-700
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-700
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-700
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-350;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0a8098008 and sellbillId = 48 and returnsellbillId = 48
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:07:40", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:07:40', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18662
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:07:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 16:07:43', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18663
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:44";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 16:07:44', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18664
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:37:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:07:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:07:52', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18665
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:03", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:08:03', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=334'); -- id=18666
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:08:07', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18667
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:08:11', '5', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=311'); -- id=18668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:08:14', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 16:08:16', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18670
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:16";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 16:08:16', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18671
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 16:08:18', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18672
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:18";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 16:08:18', '5', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18673
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:08:21', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18674
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:38:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:08:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:08:36', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18675
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:41:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:11:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:11:48', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18676
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:41:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:11:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:11:48', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18677
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:41:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:11:54", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:11:54', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18678

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada08e3a5ef1
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada08e3a5ef1 and sellbillId = 1345 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:41:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:11:54", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:11:54', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18679
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:42:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:12:25", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:12:25', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18680
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:43:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:13:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:13:01', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18681
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:47:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:17:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:17:04', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18682

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0b9a66c08
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0b9a66c08 and sellbillId = 1346 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:47:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:17:04", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:17:04', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18683
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:48:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:18:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:18:28', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18684
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:48:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:18:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:18:45', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18685
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:49:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:19:25", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:19:25', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18686

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0b946beba
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0b946beba and sellbillId = 1347 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:49:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:19:26", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:19:26', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18687
UPDATE product SET productName = 'موديل 300 الكاشف ', productDescription = '', productCatId = '94', productBuyPrice = '270.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '300.00', productDate = '2026-10-06', conditions = '0', userId = '1', limitamount = '0', parcode = '01455',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '270.00',lastbuyprice_withDiscount = '270',meanbuyprice = '270.00',meanbuyprice_withDiscount = '270' , productbuypricereal = '270.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='270',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='270',meanbuyprice_withTax='270',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='270',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1455';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1455, 1,'2026-10-22 16:19:59',5)
                ON DUPLICATE KEY UPDATE productid = 1455, edited = 1, sysdate = '2026-10-22 16:19:59', userid = 5; -- id=2220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:50:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:20:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:20:04', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18688
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:50:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:20:51", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:20:51', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18689
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('موديل 450 الكاشف ','','94','410','450','0','0','2026-10-22','0','5','0','','0','0','0','0','0','410','410','410','410','410','0','9.76','0','0','.','0','0','0','410','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','410','410','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','410','0','0','0','0','0','0','','','0','0','0','0'); -- id=2457
UPDATE product SET productName = 'موديل 450 الكاشف ', productDescription = '', productCatId = '94', productBuyPrice = '410', productSellAllPrice = '450', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02457',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '9.76' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2457';
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', '2457', '1', '2026-10-22', '5', '0','0245701','450','0','0','410','','0','0','0','0','0','0','0','0','0','0'); -- id=2457
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2457', '1', '0', '5', '2026-10-22'); -- id=3852
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2457', '1', '0', '0', '2457', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16990
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2457, 1,'2026-10-22 16:20:51',5)
                ON DUPLICATE KEY UPDATE productid = 2457, edited = 1, sysdate = '2026-10-22 16:20:51', userid = 5; -- id=3672
UPDATE product SET productName = 'موديل 450 الكاشف ', productDescription = '', productCatId = '94', productBuyPrice = '410.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02457',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '9.76' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2457';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:50:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:20:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:20:52', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18690
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:50:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:20:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:20:54', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18691
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:51", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 16:21:51', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18692
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:51", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 16:21:51', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18693
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 16:21:54', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18694
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:54";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 16:21:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 16:21:54', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18695
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:55", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 16:21:55', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18696
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:55", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-22 16:21:55', '1', '', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierController.php'); -- id=18697
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:51:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:21:56", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:21:56', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18698
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:52:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:22:02", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 16:22:02', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18699
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:52:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:22:04", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:22:04', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18700

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada06fbbbed2
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada06fbbbed2 and sellbillId = 1348 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:52:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:22:05", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:22:05', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18701
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:52:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:22:17", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 16:22:17', '1', 'oneSupplier', '41.42.136.168', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18702
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:56:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:26:04", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:26:04', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18703

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0d5e43214
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0d5e43214 and sellbillId = 1349 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:56:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:26:04", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:26:04', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18704
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:56:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:26:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:26:56', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18705
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 ('06ada0db64398e', '2026-10-22 16:20:54', '78', '1034780.00', '1100060', '0', '0', '65280.00',  '65280.00', '0', '65280', '1', '2026-10-22 16:26:56', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=345
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 ('01455', '345', '94', '1455', '96', '270', '25920.00', '0', '', '2026-10-22 16:26:56', '1455','','','0','0','0','0','0',null,'270','25920','0','0','0','0','0','0','0','0','1'); -- id=1823
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:20:54', 1, 1455, 0, 0
                    , 270, 96, 0, 0, 5, '2026-10-22 16:26:56')
                ON DUPLICATE KEY UPDATE buyprice = 270,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:26:56' ; -- id=7150
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1455', '270', '96', '0', 'buyBillController.php', '1823', '', '0', '0'); -- id=1368
UPDATE product SET  productBuyPrice = "270" WHERE productId = 1455 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1823 ;
UPDATE product SET productName = 'موديل 300 الكاشف ', productDescription = '', productCatId = '94', productBuyPrice = '270.00', productSellAllPrice = '300.00', productSellUnitPrice = '300.00', productSellHalfPrice = '300.00', productDate = '2026-10-06', conditions = '0', userId = '1', limitamount = '0', parcode = '01455',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '270',lastbuyprice_withDiscount = '270',meanbuyprice = '270',meanbuyprice_withDiscount = '270' , productbuypricereal = '270.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '11.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='270',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='270',meanbuyprice_withTax='270',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='270',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1455';
UPDATE buybilldetail SET  lastbuyprice = 270 , meanbuyprice = 270, lastbuyprice_withDiscount = 270, meanbuyprice_withDiscount = 270
        , lastbuyprice_withTax = 270, meanbuyprice_withTax = 270, lastbuyprice_withDiscountAndTax = 270
                where buybilldetailid = 1823;
UPDATE productunit SET proUnitBuyPrice  = 270 * productnumber WHERE productid = 1455;
UPDATE storedetail SET  productquantity = '96', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '1480';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1455', '1', '96', '0', '345', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '96', '5', '2026-10-22 16:20:54','0','0'); -- id=16994
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 ('02457', '345', '94', '2457', '96', '410', '39360.00', '0', '', '2026-10-22 16:26:56', '2457','','','0','0','0','0','0',null,'410','39360','0','0','0','0','0','0','0','0','1'); -- id=1824
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:20:54', 1, 2457, 0, 0
                    , 410, 96, 0, 0, 5, '2026-10-22 16:26:56')
                ON DUPLICATE KEY UPDATE buyprice = 410,
                        buyQuantity =buyQuantity+96, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:26:56' ; -- id=7151
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2457', '410', '96', '0', 'buyBillController.php', '1824', '', '0', '0'); -- id=1369
UPDATE product SET  productBuyPrice = "410" WHERE productId = 2457 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1824 ;
UPDATE product SET productName = 'موديل 450 الكاشف ', productDescription = '', productCatId = '94', productBuyPrice = '410.00', productSellAllPrice = '450.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02457',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.76' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2457';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 410, meanbuyprice_withDiscount = 410
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where buybilldetailid = 1824;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 2457;
UPDATE storedetail SET  productquantity = '96', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3852';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2457', '1', '96', '0', '345', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '96', '5', '2026-10-22 16:20:54','0','0'); -- id=16995
UPDATE supplier SET  suppliercurrentDebt = '1100060',suppliercurrentDebtInCurrency= '1100060' , userid = '5', supplierdate = '2026-10-22 16:26:56'   WHERE supplierid = '78';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1034780.00', '65280', '0', 'اضافة فاتورة مشتريات', '345', '1100060', '2026-10-22 16:20:54', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','65280','1','1034780','65280','1100060','0',''); -- id=896
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '65280', '65280', '2026-10-22', '5', '0', '0', '2026-10-22 16:26:56','اضافة فاتورة مشتريات رقم 345','1','0',null,'0','345','buyBillController.php?do=details&id=345'); -- id=4622
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4622', '382', '65280', '','0'); -- id=4752
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27151850.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4622', '504', '65280', '','0'); -- id=4624
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1100060', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
update buybill set dailyentryid='4622,0' where buybillid=345;
COMMIT;
UPDATE product SET overAllAveragePrice = 270 WHERE productId = 1455;UPDATE product SET overAllAveragePrice = 410 WHERE productId = 2457;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:56:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:26:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:26:56', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=345'); -- id=18706
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:56:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:26:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:26:58', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=345&type=2'); -- id=18707
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:29:13', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=345&type=2'); -- id=18708
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:15", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:29:15', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=345'); -- id=18709
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:29:17', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18710
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:29:17', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18711
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:17", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:29:17', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18712
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:20", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:29:20', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18713
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 12:59:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:29:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:29:55', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18714
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:00:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:30:07", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:30:07', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18715
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:00:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:30:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:30:54', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18716
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:01:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:31:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:31:53', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18717
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:01:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:31:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:31:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18718
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:14", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:14', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18719
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:24', '5', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18720
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('ترنج','2026-10-22','','0', '5','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=215
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (215, 1,'2026-10-22 16:32:24',5)
                ON DUPLICATE KEY UPDATE catid = 215, edited = 1, sysdate = '2026-10-22 16:32:24', userid = 5; -- id=230
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:25', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18721
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:26', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18722
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:28", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:32:28', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18723
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:36', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18724
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:57', '5', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18725
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('الكاشف','2026-10-22','','215', '5','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=216
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (216, 1,'2026-10-22 16:32:57',5)
                ON DUPLICATE KEY UPDATE catid = 216, edited = 1, sysdate = '2026-10-22 16:32:57', userid = 5; -- id=231
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:58", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:58', '5', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18726
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:02:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:32:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:32:59', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18727
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:03:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:33:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:33:05', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18728
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:04:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:34:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:34:55', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18729
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('ترنج قصات الكاشف ','','216','800','850','0','0','2026-10-22','0','5','0','','0','0','0','0','0','800','800','800','800','800','0','6.25','0','0','.','0','0','0','800','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','800','800','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','800','0','0','0','0','0','0','','','0','0','0','0'); -- id=2458
UPDATE product SET productName = 'ترنج قصات الكاشف ', productDescription = '', productCatId = '216', productBuyPrice = '800', productSellAllPrice = '850', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02458',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800' , buypricereal_precentage = '0' , buytotal_precentage = '6.25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2458';
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', '2458', '1', '2026-10-22', '5', '0','0245801','850','0','0','800','','0','0','0','0','0','0','0','0','0','0'); -- id=2458
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2458', '1', '0', '5', '2026-10-22'); -- id=3853
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2458', '1', '0', '0', '2458', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16996
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2458, 1,'2026-10-22 16:34:55',5)
                ON DUPLICATE KEY UPDATE productid = 2458, edited = 1, sysdate = '2026-10-22 16:34:55', userid = 5; -- id=3673
UPDATE product SET productName = 'ترنج قصات الكاشف ', productDescription = '', productCatId = '216', productBuyPrice = '800.00', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02458',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '800' , buypricereal_precentage = '0' , buytotal_precentage = '6.25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='800',meanbuyprice_withTax='800',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2458';
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 ('ترنج هوك الكاشف','','216','850','900','0','0','2026-10-22','0','5','0','','0','0','0','0','0','850','850','850','850','850','0','5.88','0','0','.','0','0','0','850','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','850','850','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','850','0','0','0','0','0','0','','','0','0','0','0'); -- id=2459
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '850', productSellAllPrice = '900', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '5.88' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
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', '2459', '1', '2026-10-22', '5', '0','0245901','900','0','0','850','','0','0','0','0','0','0','0','0','0','0'); -- id=2459
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2459', '1', '0', '5', '2026-10-22'); -- id=3854
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2459', '1', '0', '0', '2459', 'إضافة منتج', 'productController.php', '0', '0', '5', '2026-10-22','0','0'); -- id=16997
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2459, 1,'2026-10-22 16:34:55',5)
                ON DUPLICATE KEY UPDATE productid = 2459, edited = 1, sysdate = '2026-10-22 16:34:55', userid = 5; -- id=3674
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '850.00', productSellAllPrice = '900.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850',lastbuyprice_withDiscount = '850',meanbuyprice = '850',meanbuyprice_withDiscount = '850' , productbuypricereal = '850' , buypricereal_precentage = '0' , buytotal_precentage = '5.88' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='850',meanbuyprice_withTax='850',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:04:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:34:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:34:57', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18730
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:05:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:35:02", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:35:02', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18731
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:05:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:35:04", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:35:04', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18732
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:05:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:35:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:35:11', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18733
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:05:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:35:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:35:19', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18734
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:06:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:36:16", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:36:16', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18735
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:07:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:37:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:37:15', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18736
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:07:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:37:36", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:37:36', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18737
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:07:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:37:37", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:37:37', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18738
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:07:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:37:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:37:44', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18739
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 2458;
UPDATE product SET productName = 'ترنج قصات الكاشف ', productDescription = '', productCatId = '216', productBuyPrice = '750', productSellAllPrice = '850.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02458',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800.00',lastbuyprice_withDiscount = '800',meanbuyprice = '775',meanbuyprice_withDiscount = '775' , productbuypricereal = '800.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.25' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='775',meanbuyprice_withTax='775',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='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2458';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2458, 1,'2026-10-22 16:38:14',5)
                ON DUPLICATE KEY UPDATE productid = 2458, edited = 1, sysdate = '2026-10-22 16:38:14', userid = 5; -- id=3673
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2459;
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '800', productSellAllPrice = '900.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '850.00',lastbuyprice_withDiscount = '850',meanbuyprice = '825',meanbuyprice_withDiscount = '825' , productbuypricereal = '850.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.88' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',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='825',meanbuyprice_withTax='825',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='850',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2459, 1,'2026-10-22 16:39:01',5)
                ON DUPLICATE KEY UPDATE productid = 2459, edited = 1, sysdate = '2026-10-22 16:39:01', userid = 5; -- id=3674
UPDATE productunit SET unitid = '1', productid = '2191', productnumber = '1.00', productunitdate = '2026-10-15', userid = '5', conditions = '0',proUnitParcode='0219101',proUnitSellAllPrice='800',proUnitSellHalfPrice='800',proUnitSellUnitPrice ='800',proUnitBuyPrice='730',unitInTax='',proUnitPrice4='0',proUnitPrice5='0',proUnitPrice6='0',proUnitPrice7='0',proUnitPrice8='0',proUnitPrice9='0',proUnitPrice10='0',proUnitPrice11='0',proUnitPrice12='0',proUnitPrice13='0' WHERE productunitid = '2191';
UPDATE product SET productName = 'ترنج الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '750', productSellAllPrice = '850', productSellUnitPrice = '850', productSellHalfPrice = '850', productDate = '2026-10-15', conditions = '0', userId = '5', limitamount = '0', parcode = '02191',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '730.00',lastbuyprice_withDiscount = '730',meanbuyprice = '730.00',meanbuyprice_withDiscount = '730' , productbuypricereal = '730' , buypricereal_precentage = '0' , buytotal_precentage = '9.59' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730',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='730',meanbuyprice_withTax='730',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='730',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2191';
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:10:07";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:10:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:40:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:40:21', '5', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18740
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 ('06ada1150bbad4', '2026-10-22 16:36:16', '78', '1100060.00', '1168210', '0', '0', '68150.00',  '68150.00', '0', '68150', '1', '2026-10-22 16:40:21', '', '5', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=346
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 ('02193', '346', '94', '2193', '180', '370', '66600.00', '0', '', '2026-10-22 16:40:21', '2193','','','0','0','0','0','0',null,'370','66600','0','0','0','0','0','0','0','0','1'); -- id=1825
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2193, 0, 0
                    , 370, 180, 0, 0, 5, '2026-10-22 16:40:21')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+180, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:40:21' ; -- id=7152
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2193', '370', '180', '0', 'buyBillController.php', '1825', '', '0', '0'); -- id=1370
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2193 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 1825 ;
UPDATE product SET productName = 'ادايدس الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '370.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02193',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '16.22' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2193';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1825;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2193;
UPDATE storedetail SET  productquantity = '192', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3561';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2193', '1', '180', '0', '346', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '192', '5', '2026-10-22 16:36:16','0','0'); -- id=16998
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 ('02191', '346', '94', '2191', '1', '750', '750.00', '0', '', '2026-10-22 16:40:21', '2191','','','0','0','0','0','0',null,'750','750','0','0','0','0','0','0','0','0','1'); -- id=1826
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2191, 0, 0
                    , 750, 1, 0, 0, 5, '2026-10-22 16:40:21')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:40:21' ; -- id=7153
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2191', '750', '1', '0', 'buyBillController.php', '1826', '', '0', '0'); -- id=1371
UPDATE product SET  productBuyPrice = "750" WHERE productId = 2191 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1826 ;
UPDATE product SET productName = 'ترنج الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '850.00', productSellHalfPrice = '850.00', productDate = '2026-10-15', conditions = '0', userId = '5', limitamount = '0', parcode = '02191',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '730.65',meanbuyprice_withDiscount = '730.65' , productbuypricereal = '730.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.59' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='750',meanbuyprice_withTax='730.65',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2191';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 730.65, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 730.65
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 730.65, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 1826;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 2191;
UPDATE storedetail SET  productquantity = '1', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3559';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2191', '1', '1', '0', '346', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '5', '2026-10-22 16:36:16','0','0'); -- id=16999
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 ('02459', '346', '216', '2459', '1', '800', '800.00', '0', '', '2026-10-22 16:40:21', '2459','','','0','0','0','0','0',null,'800','800','0','0','0','0','0','0','0','0','1'); -- id=1827
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2459, 0, 0
                    , 800, 1, 0, 0, 5, '2026-10-22 16:40:21')
                ON DUPLICATE KEY UPDATE buyprice = 800,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:40:21' ; -- id=7154
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2459', '800', '1', '0', 'buyBillController.php', '1827', '', '0', '0'); -- id=1372
UPDATE product SET  productBuyPrice = "800" WHERE productId = 2459 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1827 ;
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '800.00', productSellAllPrice = '900.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '850.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.88' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='850',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='800',meanbuyprice_withTax='800',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
UPDATE buybilldetail SET  lastbuyprice = 800 , meanbuyprice = 800, lastbuyprice_withDiscount = 800, meanbuyprice_withDiscount = 800
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where buybilldetailid = 1827;
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2459;
UPDATE storedetail SET  productquantity = '1', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3854';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2459', '1', '1', '0', '346', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1', '5', '2026-10-22 16:36:16','0','0'); -- id=17000
UPDATE supplier SET  suppliercurrentDebt = '1168210',suppliercurrentDebtInCurrency= '1168210' , userid = '5', supplierdate = '2026-10-22 16:40:21'   WHERE supplierid = '78';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1100060.00', '68150', '0', 'اضافة فاتورة مشتريات', '346', '1168210', '2026-10-22 16:36:16', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','68150','1','1100060','68150','1168210','0',''); -- id=897
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '68150', '68150', '2026-10-22', '5', '0', '0', '2026-10-22 16:40:21','اضافة فاتورة مشتريات رقم 346','1','0',null,'0','346','buyBillController.php?do=details&id=346'); -- id=4623
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4623', '382', '68150', '','0'); -- id=4753
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27220000.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4623', '504', '68150', '','0'); -- id=4625
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1168210', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
update buybill set dailyentryid='4623,0' where buybillid=346;
COMMIT;
UPDATE product SET overAllAveragePrice = 730.33 WHERE productId = 2191;UPDATE product SET overAllAveragePrice = 370 WHERE productId = 2193;UPDATE product SET overAllAveragePrice = 800 WHERE productId = 2459;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:10:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:40:21", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:40:21', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=346'); -- id=18741
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:10:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:40:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:40:35', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=346&type=2'); -- id=18742
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:10:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:40:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:40:35', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18743
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:06', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18744
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:09", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:41:09', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=346&type=2'); -- id=18745
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:12", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:12', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=346'); -- id=18746
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:18', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18747
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:30", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:30', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18748
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:35', '5', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=346'); -- id=18749
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:50', '5', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=18750
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 346;
UPDATE buybill SET  buybillsysdate = '2026-10-22 16:41:50', userid = '5',delbyuserid = '5', conditions = '1' WHERE buybillid = '346';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2193, 0, 0
                    , 370, 180, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-180, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7152
UPDATE product SET productName = 'ادايدس الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '370.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02193',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '16.22' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2193';
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2193;
UPDATE storedetail SET  productquantity = '12', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3561';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2193', '1', '180', '1', '346', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '192', '12', '5', '2026-10-22 16:36:16','0','0'); -- id=17001
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2191, 0, 0
                    , 750, 1, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7153
UPDATE product SET productName = 'ترنج الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '850.00', productSellHalfPrice = '850.00', productDate = '2026-10-15', conditions = '0', userId = '5', limitamount = '0', parcode = '02191',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '730',lastbuyprice_withDiscount = '730',meanbuyprice = '730.01',meanbuyprice_withDiscount = '730.01' , productbuypricereal = '730.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.59' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730.33',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='730',meanbuyprice_withTax='730.01',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2191';
UPDATE productunit SET proUnitBuyPrice  = 730 * productnumber WHERE productid = 2191;
UPDATE storedetail SET  productquantity = '0', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3559';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2191', '1', '1', '1', '346', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '1', '0', '5', '2026-10-22 16:36:16','0','0'); -- id=17002
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2459, 0, 0
                    , 800, 1, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7154
UPDATE buybilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800.00, meanbuyprice_withTax = 800.00, lastbuyprice_withDiscountAndTax = 800.00
                where buybilldetailid = 1827;
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '800.00', productSellAllPrice = '900.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '0',meanbuyprice = '800.00',meanbuyprice_withDiscount = '800' , productbuypricereal = '850.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.88' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='800',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2459;
UPDATE storedetail SET  productquantity = '0', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3854';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2459', '1', '1', '1', '346', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '1', '0', '5', '2026-10-22 16:36:16','0','0'); -- id=17003
UPDATE supplier SET  suppliercurrentDebt = '1100060',suppliercurrentDebtInCurrency= '1100060' , userid = '5', supplierdate = '2026-10-22 16:41:50'   WHERE supplierid = '78';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1168210.00', '68150.00', '1', 'حذف فاتورة مشتريات - للتعديل', '346', '1100060', '2026-10-22 16:36:16', '5', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','68150','1','1168210','68150','1100060','0',''); -- id=898
UPDATE productserial SET del = 1
		 WHERE billid = 346;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ada1150bbad4', '2026-10-22 16:36:16', '78', '1100060.00', '1259660', '0', '0', '159600.00', '159600.00', '0.00', '159600', '1', '2026-10-22 16:41:50', '', '5', '0', '', '1', '1','1','346','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=347
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 ('02193', '347', '94', '2193', '180.00', '370', '66600.00', '0.00', '', '2026-10-22 16:41:50', '2193','','','0','0','0','0','0',null,'370','66600','0','0','0','0','0','0','0','0','1'); -- id=1828
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2193, 0, 0
                    , 370, 180, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+180, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7152
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2193 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 1828 ;
UPDATE product SET productName = 'ادايدس الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '370.00', productSellAllPrice = '430.00', productSellUnitPrice = '430.00', productSellHalfPrice = '430.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02193',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '16.22' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2193';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1828;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2193;
UPDATE storedetail SET  productquantity = '192', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3561';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2193', '1', '180', '0', '347', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '192', '5', '2026-10-22 16:36:16','0','0'); -- id=17004
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 ('02191', '347', '94', '2191', '60', '750', '45000.00', '0.00', '', '2026-10-22 16:41:50', '2191','','','0','0','0','0','0',null,'750','45000','0','0','0','0','0','0','0','0','1'); -- id=1829
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2191, 0, 0
                    , 750, 60, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyprice = 750,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7153
UPDATE product SET  productBuyPrice = "750" WHERE productId = 2191 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1829 ;
UPDATE product SET productName = 'ترنج الكاشف', productDescription = '', productCatId = '94', productBuyPrice = '750.00', productSellAllPrice = '850.00', productSellUnitPrice = '850.00', productSellHalfPrice = '850.00', productDate = '2026-10-15', conditions = '0', userId = '5', limitamount = '0', parcode = '02191',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '750',lastbuyprice_withDiscount = '750',meanbuyprice = '743.19',meanbuyprice_withDiscount = '743.19' , productbuypricereal = '730.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.59' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='730.33',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='750',meanbuyprice_withTax='743.19',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='750',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2191';
UPDATE buybilldetail SET  lastbuyprice = 750 , meanbuyprice = 743.19, lastbuyprice_withDiscount = 750, meanbuyprice_withDiscount = 743.19
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 743.19, lastbuyprice_withDiscountAndTax = 750
                where buybilldetailid = 1829;
UPDATE productunit SET proUnitBuyPrice  = 750 * productnumber WHERE productid = 2191;
UPDATE storedetail SET  productquantity = '60', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3559';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2191', '1', '60', '0', '347', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '5', '2026-10-22 16:36:16','0','0'); -- id=17005
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 ('02459', '347', '216', '2459', '60', '800', '48000.00', '0.00', '', '2026-10-22 16:41:50', '2459','','','0','0','0','0','0',null,'800','48000','0','0','0','0','0','0','0','0','1'); -- id=1830
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:36:16', 1, 2459, 0, 0
                    , 800, 60, 0, 0, 5, '2026-10-22 16:41:50')
                ON DUPLICATE KEY UPDATE buyprice = 800,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 5,sysDate = '2026-10-22 16:41:50' ; -- id=7154
UPDATE product SET  productBuyPrice = "800" WHERE productId = 2459 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1830 ;
UPDATE product SET productName = 'ترنج هوك الكاشف', productDescription = '', productCatId = '216', productBuyPrice = '800.00', productSellAllPrice = '900.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02459',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '800',lastbuyprice_withDiscount = '800',meanbuyprice = '800',meanbuyprice_withDiscount = '800' , productbuypricereal = '850.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.88' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='800',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='800',meanbuyprice_withTax='786.89',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='800',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2459';
UPDATE buybilldetail SET  lastbuyprice = 800 , meanbuyprice = 800, lastbuyprice_withDiscount = 800, meanbuyprice_withDiscount = 800
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 786.89, lastbuyprice_withDiscountAndTax = 800
                where buybilldetailid = 1830;
UPDATE productunit SET proUnitBuyPrice  = 800 * productnumber WHERE productid = 2459;
UPDATE storedetail SET  productquantity = '60', userid = '5', storedetaildate = '2026-10-22' WHERE storedetailid = '3854';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2459', '1', '60', '0', '347', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '5', '2026-10-22 16:36:16','0','0'); -- id=17006
DELETE FROM productserial WHERE billid = 346
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '1259660',suppliercurrentDebtInCurrency= '1259660' , userid = '5', supplierdate = '2026-10-22 16:41:50'   WHERE supplierid = '78';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('78', '1100060.00', '159600', '0', 'اضافة فاتورة مشتريات', '347', '1259660', '2026-10-22 16:41:50', '5', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','68150','1','1100060','159600','1259660','0',''); -- id=899
UPDATE dailyentry SET totalcreditor = '68150.00', totaldebtor = '68150.00', thedate = '2026-10-22', userid = '5', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 16:40:21', entryComment = 'اضافة فاتورة مشتريات رقم 346', fromFlag = '1',related='0',isopeningentry='0',operationId='346',operationDetailLink='buyBillController.php?do=details&id=346' WHERE id = '4623';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '68150.00', '68150.00', '2026-10-22', '5', '0', '4623', '2026-10-22 16:41:50','تم عكس القيد رقم 4623 ','1','0','-1','0','0',''); -- id=4624
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4624', '382', '68150.00', '','0'); -- id=4626
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27151850.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4624', '504', '68150.00', '','0'); -- id=4754
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1100060', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '159600', '159600', '2026-10-22', '5', '0', '0', '2026-10-22 16:41:50','اضافة فاتورة مشتريات رقم 347','1','0',null,'0','347','buyBillController.php?do=details&id=347'); -- id=4625
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4625', '382', '159600', '','0'); -- id=4755
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27311450.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4625', '504', '159600', '','0'); -- id=4627
UPDATE accountstree SET name = 'احمد الكاشف', customName = 'احمد الكاشف', customNameEn = 'احمد الكاشف', nameEn = 'احمد الكاشف', parent = '81', accountNature = '1', theValue = '1259660', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 19:10:02' WHERE id = '504';
update buybill set dailyentryid='4625,0' where buybillid=347;
UPDATE product SET overAllAveragePrice = 740 WHERE productId = 2191;UPDATE product SET overAllAveragePrice = 370 WHERE productId = 2193;UPDATE product SET overAllAveragePrice = 800 WHERE productId = 2459;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:41:50', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=347'); -- id=18751
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:11:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:41:55", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:41:55', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=347&type=2'); -- id=18752
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:12:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:42:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:42:56', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18753
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:13:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:43:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:43:30', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18754
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:13:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:43:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:43:46', '7', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18755
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('بيتر نادر JP','2026-10-22','','1', '7','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=217
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (217, 1,'2026-10-22 16:43:46',7)
                ON DUPLICATE KEY UPDATE catid = 217, edited = 1, sysdate = '2026-10-22 16:43:46', userid = 7; -- id=232
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '217', '1', '2026-10-22', '7', '0'); -- id=105
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:13:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:43:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:43:46', '7', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18756
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:13:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:43:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 16:43:48', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18757
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:00', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18758
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:00", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:00', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18759
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:29', '5', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=347&type=2'); -- id=18760
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:44:32', '5', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=347'); -- id=18761
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:42', '5', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18762
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:42", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:42', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18763
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:14:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:44:47", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:44:47', '5', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18764
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:15:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:45:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:45:12', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18765
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:15:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:45:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:45:46', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18766
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:15:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:45:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:45:54', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18767
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:17:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:47:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:47:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18768
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:17:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:47:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:47:18', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18769
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:17:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:47:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:47:19', '5', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18770
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:18:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:48:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:48:07', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18771
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 ('06ada13db43aba', '2026-10-22 16:47:07', '76', '227500.00', '228360', '0', '0', '860.00',  '860.00', '0', '860', '1', '2026-10-22 16:48:07', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=348
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 ('01371', '348', '91', '1371', '1', '420', '420.00', '0', '', '2026-10-22 16:48:07', '1371','','','0','0','0','0','0',null,'420','420','0','0','0','0','0','0','0','0','1'); -- id=1831
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1371, 0, 0
                    , 420, 1, 0, 0, 7, '2026-10-22 16:48:07')
                ON DUPLICATE KEY UPDATE buyprice = 420,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:48:07' ; -- id=7161
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1371', '420', '1', '0', 'buyBillController.php', '1831', '', '0', '0'); -- id=1373
UPDATE product SET  productBuyPrice = "420" WHERE productId = 1371 ;
UPDATE buybilldetail SET  quantitybefore = 48 WHERE buybilldetailid = 1831 ;
UPDATE product SET productName = 'جاكيت بوكس فيت سوسته عبد العال', productDescription = '', productCatId = '91', productBuyPrice = '420.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01371',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1371';
UPDATE buybilldetail SET  lastbuyprice = 420 , meanbuyprice = 420, lastbuyprice_withDiscount = 420, meanbuyprice_withDiscount = 420
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where buybilldetailid = 1831;
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 1371;
UPDATE storedetail SET  productquantity = '49', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1371', '1', '1', '0', '348', 'اضافة فاتورة مشتريات', 'buyBillController.php', '48', '49', '7', '2026-10-22 16:47:07','0','0'); -- id=17007
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 ('01370', '348', '91', '1370', '1', '440', '440.00', '0', '', '2026-10-22 16:48:07', '1370','','','0','0','0','0','0',null,'440','440','0','0','0','0','0','0','0','0','1'); -- id=1832
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1370, 0, 0
                    , 440, 1, 0, 0, 7, '2026-10-22 16:48:07')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+1, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:48:07' ; -- id=7162
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1370', '440', '1', '0', 'buyBillController.php', '1832', '', '0', '0'); -- id=1374
UPDATE product SET  productBuyPrice = "440" WHERE productId = 1370 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 1832 ;
UPDATE product SET productName = 'جاكيت بوكس رفرف عبد العال ', productDescription = '', productCatId = '91', productBuyPrice = '440.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01370',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1370';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1832;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 1370;
UPDATE storedetail SET  productquantity = '13', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '1', '0', '348', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '13', '7', '2026-10-22 16:47:07','0','0'); -- id=17008
UPDATE supplier SET  suppliercurrentDebt = '228360',suppliercurrentDebtInCurrency= '228360' , userid = '7', supplierdate = '2026-10-22 16:48:07'   WHERE supplierid = '76';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('76', '227500.00', '860', '0', 'اضافة فاتورة مشتريات', '348', '228360', '2026-10-22 16:47:07', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','860','1','227500','860','228360','0',''); -- id=900
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '860', '860', '2026-10-22', '7', '0', '0', '2026-10-22 16:48:07','اضافة فاتورة مشتريات رقم 348','1','0',null,'0','348','buyBillController.php?do=details&id=348'); -- id=4626
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4626', '382', '860', '','0'); -- id=4756
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27312310.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4626', '502', '860', '','0'); -- id=4628
UPDATE accountstree SET name = 'عبد العال', customName = 'عبد العال', customNameEn = 'عبد العال', nameEn = 'عبد العال', parent = '81', accountNature = '1', theValue = '228360', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 16:39:09' WHERE id = '502';
update buybill set dailyentryid='4626,0' where buybillid=348;
COMMIT;
UPDATE product SET overAllAveragePrice = 440 WHERE productId = 1370;UPDATE product SET overAllAveragePrice = 420 WHERE productId = 1371;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:18:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:48:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:48:07', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=348'); -- id=18772
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:19:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:49:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:49:11', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18773
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:19:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:49:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:49:15', '7', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=348'); -- id=18774
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:19:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:49:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:49:31', '7', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=18775
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 348;
UPDATE buybill SET  buybillsysdate = '2026-10-22 16:49:32', userid = '7',delbyuserid = '7', conditions = '1' WHERE buybillid = '348';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1371, 0, 0
                    , 420, 1, 0, 0, 7, '2026-10-22 16:49:32')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:49:32' ; -- id=7161
UPDATE product SET productName = 'جاكيت بوكس فيت سوسته عبد العال', productDescription = '', productCatId = '91', productBuyPrice = '420.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01371',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '1371';
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 1371;
UPDATE storedetail SET  productquantity = '48', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1371', '1', '1', '1', '348', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '49', '48', '7', '2026-10-22 16:47:07','0','0'); -- id=17009
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1370, 0, 0
                    , 440, 1, 0, 0, 7, '2026-10-22 16:49:32')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-1, sellQuantity = sellQuantity-0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:49:32' ; -- id=7162
UPDATE product SET productName = 'جاكيت بوكس رفرف عبد العال ', productDescription = '', productCatId = '91', productBuyPrice = '440.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01370',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '1370';
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 1370;
UPDATE storedetail SET  productquantity = '12', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '1', '1', '348', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '13', '12', '7', '2026-10-22 16:47:07','0','0'); -- id=17010
UPDATE supplier SET  suppliercurrentDebt = '227500',suppliercurrentDebtInCurrency= '227500' , userid = '7', supplierdate = '2026-10-22 16:49:32'   WHERE supplierid = '76';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('76', '228360.00', '860.00', '1', 'حذف فاتورة مشتريات - للتعديل', '348', '227500', '2026-10-22 16:47:07', '7', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','860','1','228360','860','227500','0',''); -- id=901
UPDATE productserial SET del = 1
		 WHERE billid = 348;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ada13db43aba', '2026-10-22 16:47:07', '76', '227500.00', '316900', '0', '0', '89400.00', '89400.00', '0.00', '89400', '1', '2026-10-22 16:49:32', '', '7', '0', '', '1', '1','1','348','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=349
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 ('01371', '349', '91', '1371', '150', '420', '63000.00', '0.00', '', '2026-10-22 16:49:32', '1371','','','0','0','0','0','0',null,'420','63000','0','0','0','0','0','0','0','0','1'); -- id=1833
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1371, 0, 0
                    , 420, 150, 0, 0, 7, '2026-10-22 16:49:32')
                ON DUPLICATE KEY UPDATE buyprice = 420,
                        buyQuantity =buyQuantity+150, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:49:32' ; -- id=7161
UPDATE product SET  productBuyPrice = "420" WHERE productId = 1371 ;
UPDATE buybilldetail SET  quantitybefore = 48 WHERE buybilldetailid = 1833 ;
UPDATE product SET productName = 'جاكيت بوكس فيت سوسته عبد العال', productDescription = '', productCatId = '91', productBuyPrice = '420.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01371',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '420',lastbuyprice_withDiscount = '420',meanbuyprice = '420',meanbuyprice_withDiscount = '420' , productbuypricereal = '420.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='420',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='420',meanbuyprice_withTax='420',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='420',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1371';
UPDATE buybilldetail SET  lastbuyprice = 420 , meanbuyprice = 420, lastbuyprice_withDiscount = 420, meanbuyprice_withDiscount = 420
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where buybilldetailid = 1833;
UPDATE productunit SET proUnitBuyPrice  = 420 * productnumber WHERE productid = 1371;
UPDATE storedetail SET  productquantity = '198', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1371';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1371', '1', '150', '0', '349', 'اضافة فاتورة مشتريات', 'buyBillController.php', '48', '198', '7', '2026-10-22 16:47:07','0','0'); -- id=17011
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 ('01370', '349', '91', '1370', '60', '440', '26400.00', '0.00', '', '2026-10-22 16:49:32', '1370','','','0','0','0','0','0',null,'440','26400','0','0','0','0','0','0','0','0','1'); -- id=1834
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 16:47:07', 1, 1370, 0, 0
                    , 440, 60, 0, 0, 7, '2026-10-22 16:49:32')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 16:49:32' ; -- id=7162
UPDATE product SET  productBuyPrice = "440" WHERE productId = 1370 ;
UPDATE buybilldetail SET  quantitybefore = 12 WHERE buybilldetailid = 1834 ;
UPDATE product SET productName = 'جاكيت بوكس رفرف عبد العال ', productDescription = '', productCatId = '91', productBuyPrice = '440.00', productSellAllPrice = '500.00', productSellUnitPrice = '500.00', productSellHalfPrice = '500.00', productDate = '2026-10-01', conditions = '0', userId = '1', limitamount = '0', parcode = '01370',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.09' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1370';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1834;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 1370;
UPDATE storedetail SET  productquantity = '72', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '60', '0', '349', 'اضافة فاتورة مشتريات', 'buyBillController.php', '12', '72', '7', '2026-10-22 16:47:07','0','0'); -- id=17012
DELETE FROM productserial WHERE billid = 348
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '316900',suppliercurrentDebtInCurrency= '316900' , userid = '7', supplierdate = '2026-10-22 16:49:32'   WHERE supplierid = '76';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('76', '227500.00', '89400', '0', 'اضافة فاتورة مشتريات', '349', '316900', '2026-10-22 16:49:32', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','860','1','227500','89400','316900','0',''); -- id=902
UPDATE dailyentry SET totalcreditor = '860.00', totaldebtor = '860.00', thedate = '2026-10-22', userid = '7', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 16:48:07', entryComment = 'اضافة فاتورة مشتريات رقم 348', fromFlag = '1',related='0',isopeningentry='0',operationId='348',operationDetailLink='buyBillController.php?do=details&id=348' WHERE id = '4626';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '860.00', '860.00', '2026-10-22', '7', '0', '4626', '2026-10-22 16:49:32','تم عكس القيد رقم 4626 ','1','0','-1','0','0',''); -- id=4627
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4627', '382', '860.00', '','0'); -- id=4629
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27311450.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4627', '502', '860.00', '','0'); -- id=4757
UPDATE accountstree SET name = 'عبد العال', customName = 'عبد العال', customNameEn = 'عبد العال', nameEn = 'عبد العال', parent = '81', accountNature = '1', theValue = '227500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 16:39:09' WHERE id = '502';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '89400', '89400', '2026-10-22', '7', '0', '0', '2026-10-22 16:49:32','اضافة فاتورة مشتريات رقم 349','1','0',null,'0','349','buyBillController.php?do=details&id=349'); -- id=4628
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4628', '382', '89400', '','0'); -- id=4758
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27400850.99', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4628', '502', '89400', '','0'); -- id=4630
UPDATE accountstree SET name = 'عبد العال', customName = 'عبد العال', customNameEn = 'عبد العال', nameEn = 'عبد العال', parent = '81', accountNature = '1', theValue = '316900', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-01 16:39:09' WHERE id = '502';
update buybill set dailyentryid='4628,0' where buybillid=349;
UPDATE product SET overAllAveragePrice = 440 WHERE productId = 1370;UPDATE product SET overAllAveragePrice = 420 WHERE productId = 1371;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:19:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:49:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:49:32', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=349'); -- id=18776
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:19:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:49:38", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:49:38', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=349&type=2'); -- id=18777
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:20:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:50:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:50:57', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=349&type=2'); -- id=18778
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:20:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:50:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:50:59', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=349'); -- id=18779
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:21:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:51:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:51:07', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18780
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:21:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:51:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:51:18', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=18781
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:21:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:51:24", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 16:51:24', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18782
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:21:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:51:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:51:27', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18783

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0cd09e4c9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 16:51:27', '06ada0cd09e4c9', '1', '0.00', '0', '0', '1', '9000.00', '9000', '9000', '0', '1', '2026-10-22 16:51:27', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '12' ,'0','','','','','-1','0','0','0','0','0','9000','0','','0','0','9000','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1350
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1350', '0', '2026-10-22 16:51:27', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '9000', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 16:51:27','0','0','',''); -- id=1585
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 7075;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('782','02414', '1350', '156', '2414', '4', '850', '3400', '0', '', '0', '2026-10-22 16:51:27', '2414', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7075-4,','1','1','0','0','850','3400','0','','0','0.00','0','0','0','0'); -- id=5376
UPDATE sellbilldetail SET  lastbuyprice = 850.00 , meanbuyprice = 850.00, lastbuyprice_withDiscount = 782.00, meanbuyprice_withDiscount = 782.00
        , lastbuyprice_withTax = 850, meanbuyprice_withTax = 850, lastbuyprice_withDiscountAndTax = 782
                where sellbilldetailid = 5376;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2414, '2026-10-22', 3400, 3400, 3400
                    , 3400, 3128, 3128, 3128
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 3400, 3400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3400, sellCostBuyPrice =sellCostBuyPrice+3400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3128, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3128
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3128
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3400, 3400, 3400
                    , 3400, 3128, 3128, 3128
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3400, 3400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3400, sellCostBuyPrice =sellCostBuyPrice+3400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3128, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3128
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3128
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '40', userid = '6', storedetaildate = '2026-10-22 16:51:27' WHERE storedetailid = '3809';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2414', '1', '4', '1', '1350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '44', '40', '6', '2026-10-22 16:51:27','0','0'); -- id=17013
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','02040', '1350', '54', '2040', '3', '450', '1350', '0', '', '0', '2026-10-22 16:51:27', '2040', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6072-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5377
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 5377;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2040, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '144', userid = '6', storedetaildate = '2026-10-22 16:51:27' WHERE storedetailid = '3399';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2040', '1', '3', '1', '1350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '147', '144', '6', '2026-10-22 16:51:27','0','0'); -- id=17014
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 7111;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01698', '1350', '130', '1698', '5', '850', '4250', '0', '', '0', '2026-10-22 16:51:27', '1698', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7111-5,','1','1','0','0','850','4250','0','','0','0.00','0','0','0','0'); -- id=5378
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5378;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-22', 4250, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4250, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4250, 4000, 4000
                    , 4000, 4000, 4000, 4000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4000, 4000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4250, sellCostBuyPrice =sellCostBuyPrice+4000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '67', userid = '6', storedetaildate = '2026-10-22 16:51:27' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '5', '1', '1350', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '67', '6', '2026-10-22 16:51:27','0','0'); -- id=17015
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1348470',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1339470','9000', '0', '4', 'اضافة فاتورة مبيعات', '1350', '1348470', '2026-10-22 16:51:27', '6',  'sellbillController.php','1','','0'); -- id=1659
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9000', '9000', '2026-10-22', '6', '0', '0', '2026-10-22 16:51:27','اضافة فاتورة مبيعات رقم 1350','1','0',null,'0','1350','sellbillController.php?do=showDetail&sellbillid=1350'); -- id=4629
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4629', '568', '9000', '','0'); -- id=4759
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1348470', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4629', '143', '9000', '','0'); -- id=4631
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15278395', 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 ( '8343', '8343', '2026-10-22', '6', '0', '0', '2026-10-22 16:51:27','اضافة فاتورة مبيعات رقم 1350 - صرف البضاعة من المخزن','1','0',null,'0','1350','sellbillController.php?do=showDetail&sellbillid=1350'); -- id=4630
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4630', '402', '8343', '','0'); -- id=4760
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14134501.21', 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 ('4630', '382', '8343', '','0'); -- id=4632
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27392507.99', 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='4629,0,4630' where sellbillid=1350;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 9000, 8750, 8750
                    , 8750, 8343, 8343, 8343
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8750, 8750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9000, sellCostBuyPrice =sellCostBuyPrice+8750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8343, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8343
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8343
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 9000, 8750, 8750
                    , 8750, 8343, 8343, 8343
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8750, 8750, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9000, sellCostBuyPrice =sellCostBuyPrice+8750
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8750, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8750
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8343, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8343
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8343
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8750
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8750
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 9000, 8750, 8750
                    , 8750, 8343, 8343, 8343, 8750, 8750)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+9000, netSellCostBuyPrice = netSellCostBuyPrice+8750
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8750
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8750
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8343
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8343
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8343
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8750
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8750;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0cd09e4c9 and sellbillId = 1350 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:21:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:51:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:51:27', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18784
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:22:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:52:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:52:30', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18785
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:22:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:52:40", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:52:40', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18786
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:22:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:52:40", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:52:40', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18787
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:22:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:52:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 16:52:56', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18788
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:24:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:54:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 16:54:36', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18789
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:24:36";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 16:54:36', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18790
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:27:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:57:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:57:17', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18791

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0dfd3d977
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 16:57:17', '06ada0dfd3d977', '1', '0.00', '0', '0', '1', '6775.00', '6775', '6775', '0', '1', '2026-10-22 16:57:17', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '20' ,'0','','','','','-1','0','0','0','0','0','6775','0','','0','0','6775','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1351
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1351', '0', '2026-10-22 16:57:17', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6775', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 16:57:17','0','0','',''); -- id=1586
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1351', '190', '2176', '3', '330', '990', '0', '', '0', '2026-10-22 16:57:17', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5379
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5379;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '65', userid = '2', storedetaildate = '2026-10-22 16:57:17' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '3', '1', '1351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '68', '65', '2', '2026-10-22 16:57:17','0','0'); -- id=17016
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7099;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02425', '1351', '190', '2425', '8', '320', '2560', '0', '', '0', '2026-10-22 16:57:17', '2425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7099-8,','1','1','0','0','320','2560','0','','0','0.00','0','0','0','0'); -- id=5380
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5380;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2425, '2026-10-22', 2560, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2560, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2560, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '2', storedetaildate = '2026-10-22 16:57:17' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '8', '1', '1351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '28', '20', '2', '2026-10-22 16:57:17','0','0'); -- id=17017
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1085;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('275','01924', '1351', '154', '1924', '3', '295', '885', '0', '', '0', '2026-10-22 16:57:17', '1924', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1085-3,','1','1','0','0','295','885','0','','0','0.00','0','0','0','0'); -- id=5381
UPDATE sellbilldetail SET  lastbuyprice = 275.00 , meanbuyprice = 275.00, lastbuyprice_withDiscount = 275.00, meanbuyprice_withDiscount = 275.00
        , lastbuyprice_withTax = 275, meanbuyprice_withTax = 275, lastbuyprice_withDiscountAndTax = 275
                where sellbilldetailid = 5381;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1924, '2026-10-22', 885, 825, 825
                    , 825, 825, 825, 825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 825, 825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 885, 825, 825
                    , 825, 825, 825, 825
                    , 0, 0, 0, 0
                    , 0, 0, 0, 825, 825, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+885, sellCostBuyPrice =sellCostBuyPrice+825
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+825, sellCostMeanBuyPrice = sellCostMeanBuyPrice+825
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+825, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+825
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+825
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+825
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+825
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '177', userid = '2', storedetaildate = '2026-10-22 16:57:17' WHERE storedetailid = '2941';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1924', '1', '3', '1', '1351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '180', '177', '2', '2026-10-22 16:57:17','0','0'); -- id=17018
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1351', '147', '1885', '6', '390', '2340', '0', '', '0', '2026-10-22 16:57:17', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5382
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5382;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2340, 2154, 2154
                    , 2154, 2154, 2154, 2154
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2154, 2154, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2154
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2154, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2154
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2154, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2154
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2154
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2154
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2154
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '49', userid = '2', storedetaildate = '2026-10-22 16:57:17' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '6', '1', '1351', 'اضافة فاتورة مبيعات', 'sellbillController.php', '55', '49', '2', '2026-10-22 16:57:17','0','0'); -- id=17019
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8662591',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8655816','6775', '0', '2', 'اضافة فاتورة مبيعات', '1351', '8662591', '2026-10-22 16:57:17', '2',  'sellbillController.php','1','','0'); -- id=1660
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6775', '6775', '2026-10-22', '2', '0', '0', '2026-10-22 16:57:17','اضافة فاتورة مبيعات رقم 1351','1','0',null,'0','1351','sellbillController.php?do=showDetail&sellbillid=1351'); -- id=4631
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4631', '419', '6775', '','0'); -- id=4761
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8662590.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4631', '143', '6775', '','0'); -- id=4633
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15285170', 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 ( '6309', '6309', '2026-10-22', '2', '0', '0', '2026-10-22 16:57:17','اضافة فاتورة مبيعات رقم 1351 - صرف البضاعة من المخزن','1','0',null,'0','1351','sellbillController.php?do=showDetail&sellbillid=1351'); -- id=4632
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4632', '402', '6309', '','0'); -- id=4762
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14140810.21', 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 ('4632', '382', '6309', '','0'); -- id=4634
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27386198.99', 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='4631,0,4632' where sellbillid=1351;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6775, 6309, 6309
                    , 6309, 6309, 6309, 6309
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6309, 6309, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6775, sellCostBuyPrice =sellCostBuyPrice+6309
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6309, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6309
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6309, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6309
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6309
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6309
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6309
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6775, 6309, 6309
                    , 6309, 6309, 6309, 6309
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6309, 6309, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6775, sellCostBuyPrice =sellCostBuyPrice+6309
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6309, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6309
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6309, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6309
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6309
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6309
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6309
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 6775, 6309, 6309
                    , 6309, 6309, 6309, 6309, 6309, 6309)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6775, netSellCostBuyPrice = netSellCostBuyPrice+6309
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6309
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6309
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6309
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6309
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6309
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6309
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6309;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0dfd3d977 and sellbillId = 1351 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:27:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 16:57:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 16:57:17', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18792
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:31:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:01:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:01:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18793
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:31:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:01:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:01:39', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18794
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:31:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:01:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:01:48', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18795

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0eeccd190
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:01:48', '06ada0eeccd190', '1', '0.00', '0', '0', '1', '24390.00', '24390', '24390', '0', '1', '2026-10-22 17:01:48', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '63' ,'0','','','','','-1','0','0','0','0','0','24390','0','','0','0','24390','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1352
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1352', '0', '2026-10-22 17:01:48', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '24390', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:01:48','0','0','',''); -- id=1587
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6913;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('368','01584', '1352', '115', '1584', '9', '400', '3600', '0', '', '0', '2026-10-22 17:01:48', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6913-9,','1','1','0','0','400','3600','0','','0','0.00','0','0','0','0'); -- id=5383
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 368.00, meanbuyprice_withDiscount = 368.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 368
                where sellbilldetailid = 5383;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-22', 3600, 3600, 3600
                    , 3600, 3312, 3312, 3342.51
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3342.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3600, 3600, 3600
                    , 3600, 3312, 3312, 3342.51
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3342.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '9', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '21', '3', '2026-10-22 17:01:48','0','0'); -- id=17020
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1352', '147', '1886', '9', '320', '2880', '0', '', '0', '2026-10-22 17:01:48', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6989-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5384
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5384;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 2880, 2601, 2601
                    , 2601, 2601, 2601, 2601
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2601, 2601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2601, 2601
                    , 2601, 2601, 2601, 2601
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2601, 2601, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2601
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2601, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2601
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2601, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2601
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2601
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2601
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2601
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '52', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '9', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '61', '52', '3', '2026-10-22 17:01:48','0','0'); -- id=17021
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1352', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 17:01:48', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5385
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5385;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '287', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '290', '287', '3', '2026-10-22 17:01:48','0','0'); -- id=17022
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1352', '147', '1885', '12', '390', '4680', '0', '', '0', '2026-10-22 17:01:48', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-12,','1','1','0','0','390','4680','0','','0','0.00','0','0','0','0'); -- id=5386
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5386;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 4680, 4308, 4308
                    , 4308, 4308, 4308, 4308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4308, 4308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4680, 4308, 4308
                    , 4308, 4308, 4308, 4308
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4308, 4308, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4680, sellCostBuyPrice =sellCostBuyPrice+4308
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4308, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4308
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4308, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4308
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4308
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4308
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4308
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '37', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '12', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '49', '37', '3', '2026-10-22 17:01:48','0','0'); -- id=17023
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 5982;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('372','02015', '1352', '115', '2015', '6', '400', '2400', '0', '', '0', '2026-10-22 17:01:48', '2015', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','5982-6,','1','1','0','0','400','2400','0','','0','0.00','0','0','0','0'); -- id=5387
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 372.00, meanbuyprice_withDiscount = 372.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 372
                where sellbilldetailid = 5387;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2015, '2026-10-22', 2400, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2400, 2400, 2400
                    , 2400, 2232, 2232, 2232
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2232, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2232
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2232
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '3374';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2015', '1', '6', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '6', '3', '2026-10-22 17:01:48','0','0'); -- id=17024
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('358.8','01895', '1352', '148', '1895', '6', '390', '2340', '0', '', '0', '2026-10-22 17:01:48', '1895', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','989-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5388
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 358.80, meanbuyprice_withDiscount = 360.64
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 358.8
                where sellbilldetailid = 5388;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1895, '2026-10-22', 2340, 2340, 2340
                    , 2340, 2152.8, 2163.84, 2152.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2152.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2163.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2152.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2340, 2340, 2340
                    , 2340, 2152.8, 2163.84, 2152.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2152.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2163.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2152.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '54', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '2912';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1895', '1', '6', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '54', '3', '2026-10-22 17:01:48','0','0'); -- id=17025
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6512;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('363.4','02148', '1352', '187', '2148', '12', '395', '4740', '0', '', '0', '2026-10-22 17:01:48', '2148', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6512-12,','1','1','0','0','395','4740','0','','0','0.00','0','0','0','0'); -- id=5389
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 363.40, meanbuyprice_withDiscount = 363.40
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 363.4
                where sellbilldetailid = 5389;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2148, '2026-10-22', 4740, 4740, 4740
                    , 4740, 4360.8, 4360.8, 4360.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4740, 4740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4740, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4360.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4360.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4360.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4740, 4740, 4740
                    , 4740, 4360.8, 4360.8, 4360.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4740, 4740, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4740, sellCostBuyPrice =sellCostBuyPrice+4740
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4740, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4740
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4360.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4360.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4360.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4740
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4740
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '39', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '3507';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2148', '1', '12', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '39', '3', '2026-10-22 17:01:48','0','0'); -- id=17026
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('358.8','01895', '1352', '148', '1895', '6', '390', '2340', '0', '', '0', '2026-10-22 17:01:48', '1895', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','989-6,','1','1','0','0','390','2340','0','','0','0.00','0','0','0','0'); -- id=5390
UPDATE sellbilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 358.80, meanbuyprice_withDiscount = 360.64
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 390, lastbuyprice_withDiscountAndTax = 358.8
                where sellbilldetailid = 5390;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1895, '2026-10-22', 2340, 2340, 2340
                    , 2340, 2152.8, 2163.84, 2152.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2152.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2163.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2152.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2340, 2340, 2340
                    , 2340, 2152.8, 2163.84, 2152.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2340, 2340, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2340, sellCostBuyPrice =sellCostBuyPrice+2340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2152.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2163.84
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2152.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2340
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2340
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '3', storedetaildate = '2026-10-22 17:01:48' WHERE storedetailid = '2912';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1895', '1', '6', '1', '1352', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '48', '3', '2026-10-22 17:01:48','0','0'); -- id=17027
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8686981',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8662591','24390', '0', '2', 'اضافة فاتورة مبيعات', '1352', '8686981', '2026-10-22 17:01:48', '3',  'sellbillController.php','1','','0'); -- id=1661
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '24390', '24390', '2026-10-22', '3', '0', '0', '2026-10-22 17:01:48','اضافة فاتورة مبيعات رقم 1352','1','0',null,'0','1352','sellbillController.php?do=showDetail&sellbillid=1352'); -- id=4633
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4633', '419', '24390', '','0'); -- id=4763
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8686980.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4633', '143', '24390', '','0'); -- id=4635
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15309560', 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 ( '22469.4', '22469.4', '2026-10-22', '3', '0', '0', '2026-10-22 17:01:48','اضافة فاتورة مبيعات رقم 1352 - صرف البضاعة من المخزن','1','0',null,'0','1352','sellbillController.php?do=showDetail&sellbillid=1352'); -- id=4634
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4634', '402', '22469.4', '','0'); -- id=4764
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14163279.61', 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 ('4634', '382', '22469.4', '','0'); -- id=4636
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27363729.59', 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='4633,0,4634' where sellbillid=1352;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 24390, 23679, 23679
                    , 23679, 22469.4, 22491.48, 22499.91
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23679, 23679, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24390, sellCostBuyPrice =sellCostBuyPrice+23679
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23679, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23679
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22469.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22491.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22499.91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23679
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23679
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 24390, 23679, 23679
                    , 23679, 22469.4, 22491.48, 22499.91
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,23679, 23679, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+24390, sellCostBuyPrice =sellCostBuyPrice+23679
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+23679, sellCostMeanBuyPrice = sellCostMeanBuyPrice+23679
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+22469.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+22491.48
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+22499.91
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+23679
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+23679
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 24390, 23679, 23679
                    , 23679, 22469.4, 22491.48, 22499.91, 23679, 23679)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+24390, netSellCostBuyPrice = netSellCostBuyPrice+23679
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+23679
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+23679
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+22469.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+22491.48
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+22499.91
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+23679
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+23679;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0eeccd190 and sellbillId = 1352 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:31:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:01:48", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:01:48', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18796
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:34:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:04:25", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:04:25', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18797

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada14df7cd41
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:04:25', '06ada14df7cd41', '1', '0.00', '0', '0', '1', '8850.00', '8850', '8850', '0', '1', '2026-10-22 17:04:25', '', '6', '0', 'نقدي', '4', '0', '3', '0', 'نقدي', '18' ,'0','','','','','-1','0','0','0','0','0','8850','0','','0','0','8850','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1353
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1353', '0', '2026-10-22 17:04:25', '6', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8850', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:04:25','0','0','',''); -- id=1588
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('405','02040', '1353', '54', '2040', '3', '450', '1350', '0', '', '0', '2026-10-22 17:04:25', '2040', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6072-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5391
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 405.00, meanbuyprice_withDiscount = 405.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 405
                where sellbilldetailid = 5391;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2040, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1215, 1215, 1215
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1215, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1215
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1215
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '6', storedetaildate = '2026-10-22 17:04:25' WHERE storedetailid = '3399';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2040', '1', '3', '1', '1353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '144', '141', '6', '2026-10-22 17:04:25','0','0'); -- id=17028
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6707;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02252', '1353', '191', '2252', '3', '370', '1110', '0', '', '0', '2026-10-22 17:04:25', '2252', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6707-3,','1','1','0','0','370','1110','0','','0','0.00','0','0','0','0'); -- id=5392
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5392;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2252, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1110, 900, 900
                    , 900, 900, 900, 900
                    , 0, 0, 0, 0
                    , 0, 0, 0, 900, 900, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1110, sellCostBuyPrice =sellCostBuyPrice+900
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+900, sellCostMeanBuyPrice = sellCostMeanBuyPrice+900
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+900, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+900
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+900
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+900
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+900
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '86', userid = '6', storedetaildate = '2026-10-22 17:04:25' WHERE storedetailid = '3643';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2252', '1', '3', '1', '1353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '89', '86', '6', '2026-10-22 17:04:25','0','0'); -- id=17029
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6723;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02260', '1353', '199', '2260', '6', '465', '2790', '0', '', '0', '2026-10-22 17:04:25', '2260', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6723-6,','1','1','0','0','465','2790','0','','0','0.00','0','0','0','0'); -- id=5393
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5393;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2260, '2026-10-22', 2790, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2790, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2790, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2790, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '48', userid = '6', storedetaildate = '2026-10-22 17:04:25' WHERE storedetailid = '3651';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2260', '1', '6', '1', '1353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '54', '48', '6', '2026-10-22 17:04:25','0','0'); -- id=17030
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6539;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('570','02228', '1353', '194', '2228', '6', '600', '3600', '0', '', '0', '2026-10-22 17:04:25', '2228', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6539-6,','1','1','0','0','600','3600','0','','0','0.00','0','0','0','0'); -- id=5394
UPDATE sellbilldetail SET  lastbuyprice = 570.00 , meanbuyprice = 570.00, lastbuyprice_withDiscount = 570.00, meanbuyprice_withDiscount = 570.00
        , lastbuyprice_withTax = 570, meanbuyprice_withTax = 570, lastbuyprice_withDiscountAndTax = 570
                where sellbilldetailid = 5394;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2228, '2026-10-22', 3600, 3420, 3420
                    , 3420, 3420, 3420, 3420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3420, 3420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3600, 3420, 3420
                    , 3420, 3420, 3420, 3420
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3420, 3420, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3600, sellCostBuyPrice =sellCostBuyPrice+3420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3420
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3420
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3420
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3420
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '6', storedetaildate = '2026-10-22 17:04:25' WHERE storedetailid = '3619';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2228', '1', '6', '1', '1353', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '6', '2026-10-22 17:04:25','0','0'); -- id=17031
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1357320',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1348470','8850', '0', '4', 'اضافة فاتورة مبيعات', '1353', '1357320', '2026-10-22 17:04:25', '6',  'sellbillController.php','1','','0'); -- id=1662
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8850', '8850', '2026-10-22', '6', '0', '0', '2026-10-22 17:04:25','اضافة فاتورة مبيعات رقم 1353','1','0',null,'0','1353','sellbillController.php?do=showDetail&sellbillid=1353'); -- id=4635
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4635', '568', '8850', '','0'); -- id=4765
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1357320', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4635', '143', '8850', '','0'); -- id=4637
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15318410', 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 ( '8235', '8235', '2026-10-22', '6', '0', '0', '2026-10-22 17:04:25','اضافة فاتورة مبيعات رقم 1353 - صرف البضاعة من المخزن','1','0',null,'0','1353','sellbillController.php?do=showDetail&sellbillid=1353'); -- id=4636
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4636', '402', '8235', '','0'); -- id=4766
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14171514.61', 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 ('4636', '382', '8235', '','0'); -- id=4638
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27355494.59', 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='4635,0,4636' where sellbillid=1353;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 8850, 8370, 8370
                    , 8370, 8235, 8235, 8235
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8370, 8370, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8850, sellCostBuyPrice =sellCostBuyPrice+8370
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8370, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8370
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8235, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8235
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8235
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8370
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8370
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8850, 8370, 8370
                    , 8370, 8235, 8235, 8235
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8370, 8370, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8850, sellCostBuyPrice =sellCostBuyPrice+8370
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8370, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8370
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8235, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8235
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8235
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8370
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8370
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 8850, 8370, 8370
                    , 8370, 8235, 8235, 8235, 8370, 8370)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8850, netSellCostBuyPrice = netSellCostBuyPrice+8370
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8370
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8370
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+8235
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+8235
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+8235
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8370
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8370;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada14df7cd41 and sellbillId = 1353 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:34:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:04:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:04:26', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18798
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:36:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:06:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:06:27', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18799

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada163dbb674
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:06:27', '06ada163dbb674', '1', '0.00', '0', '0', '1', '10520.00', '10520', '10520', '0', '1', '2026-10-22 17:06:27', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '26' ,'0','','','','','-1','0','0','0','0','0','10520','0','','0','0','10520','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1354
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1354', '0', '2026-10-22 17:06:27', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '10520', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:06:27','0','0','',''); -- id=1589
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1354', '166', '2028', '12', '320', '3840', '0', '', '0', '2026-10-22 17:06:27', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5395
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5395;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 3840, 3840, 3840
                    , 3840, 3571.2, 3571.2, 3563.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3571.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3571.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3563.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3840, 3840
                    , 3840, 3571.2, 3571.2, 3563.52
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3840, 3840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3571.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3571.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3563.52
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '90', userid = '2', storedetaildate = '2026-10-22 17:06:27' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '12', '1', '1354', 'اضافة فاتورة مبيعات', 'sellbillController.php', '102', '90', '2', '2026-10-22 17:06:27','0','0'); -- id=17032
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6167;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('331.2','02104', '1354', '179', '2104', '6', '360', '2160', '0', '', '0', '2026-10-22 17:06:27', '2104', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6167-6,','1','1','0','0','360','2160','0','','0','0.00','0','0','0','0'); -- id=5396
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 331.20, meanbuyprice_withDiscount = 331.20
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 331.2
                where sellbilldetailid = 5396;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2104, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1987.2, 1987.2, 1987.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1987.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1987.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1987.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2160, 2160, 2160
                    , 2160, 1987.2, 1987.2, 1987.2
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2160, 2160, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2160, sellCostBuyPrice =sellCostBuyPrice+2160
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2160, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2160
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1987.2, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1987.2
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1987.2
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2160
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2160
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '81', userid = '2', storedetaildate = '2026-10-22 17:06:27' WHERE storedetailid = '3463';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2104', '1', '6', '1', '1354', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '81', '2', '2026-10-22 17:06:27','0','0'); -- id=17033
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 681;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('525','01767', '1354', '137', '1767', '8', '565', '4520', '0', '', '0', '2026-10-22 17:06:27', '1767', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','681-8,','1','1','0','0','565','4520','0','','0','0.00','0','0','0','0'); -- id=5397
UPDATE sellbilldetail SET  lastbuyprice = 525.00 , meanbuyprice = 525.00, lastbuyprice_withDiscount = 525.00, meanbuyprice_withDiscount = 525.00
        , lastbuyprice_withTax = 525, meanbuyprice_withTax = 525, lastbuyprice_withDiscountAndTax = 525
                where sellbilldetailid = 5397;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1767, '2026-10-22', 4520, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4520, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4520, 4200, 4200
                    , 4200, 4200, 4200, 4200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4200, 4200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4520, sellCostBuyPrice =sellCostBuyPrice+4200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '16', userid = '2', storedetaildate = '2026-10-22 17:06:27' WHERE storedetailid = '2780';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1767', '1', '8', '1', '1354', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '16', '2', '2026-10-22 17:06:27','0','0'); -- id=17034
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8697501',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8686981','10520', '0', '2', 'اضافة فاتورة مبيعات', '1354', '8697501', '2026-10-22 17:06:27', '2',  'sellbillController.php','1','','0'); -- id=1663
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '10520', '10520', '2026-10-22', '2', '0', '0', '2026-10-22 17:06:27','اضافة فاتورة مبيعات رقم 1354','1','0',null,'0','1354','sellbillController.php?do=showDetail&sellbillid=1354'); -- id=4637
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4637', '419', '10520', '','0'); -- id=4767
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8697500.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4637', '143', '10520', '','0'); -- id=4639
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15328930', 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 ( '9758.4', '9758.4', '2026-10-22', '2', '0', '0', '2026-10-22 17:06:27','اضافة فاتورة مبيعات رقم 1354 - صرف البضاعة من المخزن','1','0',null,'0','1354','sellbillController.php?do=showDetail&sellbillid=1354'); -- id=4638
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4638', '402', '9758.4', '','0'); -- id=4768
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14181273.01', 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 ('4638', '382', '9758.4', '','0'); -- id=4640
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27345736.19', 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='4637,0,4638' where sellbillid=1354;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 10520, 10200, 10200
                    , 10200, 9758.4, 9758.4, 9750.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10200, 10200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10520, sellCostBuyPrice =sellCostBuyPrice+10200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9758.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9758.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10520, 10200, 10200
                    , 10200, 9758.4, 9758.4, 9750.72
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,10200, 10200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10520, sellCostBuyPrice =sellCostBuyPrice+10200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+10200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+10200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9758.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9758.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9750.72
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+10200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+10200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 10520, 10200, 10200
                    , 10200, 9758.4, 9758.4, 9750.72, 10200, 10200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+10520, netSellCostBuyPrice = netSellCostBuyPrice+10200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+10200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+10200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+9758.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+9758.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+9750.72
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+10200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+10200;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada163dbb674 and sellbillId = 1354 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:36:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:06:27", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:06:27', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18800
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:46:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:16:44", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:16:44', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18801

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada17ea13f28
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada17ea13f28 and sellbillId = 1355 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:46:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:16:45", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:16:45', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18802
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:52:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:22:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:22:46', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18803
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:53:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:23:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:23:07', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18804

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada1c36213dc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 17:23:07', '06ada1c36213dc', '1', '0.00', '0', '0', '1', '690', '690', '-690', '0', '1', '2026-10-22 17:23:07', '', '2', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-690','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=49
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','49', '0', '2026-10-22 17:23:07', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '690', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:23:07','0','0','',''); -- id=1591
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('305.00', '01434', '49', '100', '1434', '1', '340', '340', '0', '', '0', '0', '1434', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','340','340','0','','0'); -- id=71
UPDATE returnsellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 307.50, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 307.50
        , lastbuyprice_withTax = 307.5, meanbuyprice_withTax = 307.5, lastbuyprice_withDiscountAndTax = 310
                where returnsellbilldetailid = 71;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1434, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 340, 305, 310, 307.5
                    , 310, 307.5, 310, 0, 1, 0, 0, 307.5, 307.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+340, returnSellCostBuyPrice = returnSellCostBuyPrice+305, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+310
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+307.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+310
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+307.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+310
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+307.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+307.5
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 340, 305, 310, 307.5
                    , 310, 307.5, 310, 0, 0, 307.5, 307.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+340, returnSellCostBuyPrice = returnSellCostBuyPrice+305, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+310
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+307.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+310
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+307.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+310
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+307.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+307.5;
UPDATE storedetail SET  productquantity = '13', userid = '2', storedetaildate = '2026-10-22 17:23:07' WHERE storedetailid = '1447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1434', '1', '1', '0', '49', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '12', '13', '2', '2026-10-22 17:23:07','0','0'); -- id=17036
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('350.00', '02120', '49', '182', '2120', '1', '350', '350', '0', '', '0', '0', '2120', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','350','350','0','','0'); -- id=72
UPDATE returnsellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where returnsellbilldetailid = 72;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2120, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 350, 350, 350, 350
                    , 315, 315, 315, 0, 1, 0, 0, 350, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+350, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+315
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+315
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+315
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 350, 350, 350, 350
                    , 315, 315, 315, 0, 0, 350, 350)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+350, returnSellCostBuyPrice = returnSellCostBuyPrice+350, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+350
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+350, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+315
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+315
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+315
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+350
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+350;
UPDATE storedetail SET  productquantity = '1', userid = '2', storedetaildate = '2026-10-22 17:23:07' WHERE storedetailid = '3479';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2120', '1', '1', '0', '49', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '0', '1', '2', '2026-10-22 17:23:07','0','0'); -- id=17037
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8696811',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8697501','-690', '1', '2', 'اضافة فاتورة مردوات مبيعات', '49', '8696811', '2026-10-22 17:23:07', '2',  'returnsellbillController.php','1','','0'); -- id=1665
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '690', '690', '2026-10-22', '2', '0', '0', '2026-10-22 17:23:07','اضافة فاتورة مردود مبيعات رقم 49','1','0',null,'0','49','returnsellbillController.php?do=showDetail&returnsellbillid=49'); -- id=4641
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4641', '143', '690', '','0'); -- id=4771
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15335140', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4641', '419', '690', '','0'); -- id=4643
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8696810.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '625', '625', '2026-10-22', '2', '0', '0', '2026-10-22 17:23:07','اضافة فاتورة مردود مبيعات رقم 49 - صرف البضاعة من المخزن','1','0',null,'0','49','returnsellbillController.php?do=showDetail&returnsellbillid=49'); -- id=4642
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4642', '382', '625', '','0'); -- id=4772
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27339881.19', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4642', '402', '625', '','0'); -- id=4644
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14187128.01', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4641,0,4642' where returnsellbillid=49;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 690, 655, 660, 657.5
                    , 625, 622.5, 625 ,0, 0, 657.5, 657.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+690, returnSellCostBuyPrice = returnSellCostBuyPrice+655, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+660
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+657.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+625
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+622.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+625
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+657.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+657.5;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 690, 655, 660, 657.5
                    , 625, 622.5, 625 ,0, 0, 657.5, 657.5)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+690, returnSellCostBuyPrice = returnSellCostBuyPrice+655, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+660
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+657.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+625
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+622.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+625
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+657.5
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+657.5;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -690, -655, -660
                    , -657.5, -625, -622.5, -625, -657.5, -657.5)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-690, netSellCostBuyPrice = netSellCostBuyPrice+-655
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-660
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-657.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-625
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-622.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-625
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-657.5
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-657.5;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada1c36213dc and sellbillId = 49 and returnsellbillId = 49
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:53:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:23:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:23:07', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18805
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:54:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:24:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:24:11', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18806

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada186391e5a
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada186391e5a and sellbillId = 1356 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:54:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:24:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:24:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18807
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 13:59:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:29:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:29:57', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=18808
UPDATE user SET loginip = "" WHERE userid = 4;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:01:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:31:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:31:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18809
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:01:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:31:23", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:31:23', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18810
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:01:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:31:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:31:29', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18811

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada174d0983f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:31:29', '06ada174d0983f', '1', '0.00', '0', '0', '1', '12585.00', '12585', '12585', '0', '1', '2026-10-22 17:31:29', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '33' ,'0','','','','','-1','0','0','0','0','0','12585','0','','0','0','12585','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1357
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1357', '0', '2026-10-22 17:31:29', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '12585', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:31:29','0','0','',''); -- id=1593
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6950;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('348.75','02339', '1357', '166', '2339', '9', '375', '3375', '0', '', '0', '2026-10-22 17:31:29', '2339', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6950-9,','1','1','0','0','375','3375','0','','0','0.00','0','0','0','0'); -- id=5401
UPDATE sellbilldetail SET  lastbuyprice = 375.00 , meanbuyprice = 375.00, lastbuyprice_withDiscount = 348.75, meanbuyprice_withDiscount = 348.75
        , lastbuyprice_withTax = 375, meanbuyprice_withTax = 375, lastbuyprice_withDiscountAndTax = 348.75
                where sellbilldetailid = 5401;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2339, '2026-10-22', 3375, 3375, 3375
                    , 3375, 3138.75, 3138.75, 3138.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3375, 3375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3375, sellCostBuyPrice =sellCostBuyPrice+3375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3138.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3138.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3138.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3375, 3375, 3375
                    , 3375, 3138.75, 3138.75, 3138.75
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3375, 3375, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3375, sellCostBuyPrice =sellCostBuyPrice+3375
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3375, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3375
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3138.75, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3138.75
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3138.75
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3375
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3375
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '3', storedetaildate = '2026-10-22 17:31:29' WHERE storedetailid = '3733';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2339', '1', '9', '1', '1357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '27', '3', '2026-10-22 17:31:29','0','0'); -- id=17040
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1357', '166', '2028', '9', '320', '2880', '0', '', '0', '2026-10-22 17:31:29', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5402
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5402;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '81', userid = '3', storedetaildate = '2026-10-22 17:31:29' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '9', '1', '1357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '90', '81', '3', '2026-10-22 17:31:29','0','0'); -- id=17041
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6991;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('359','01885', '1357', '147', '1885', '9', '390', '3510', '0', '', '0', '2026-10-22 17:31:29', '1885', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6991-9,','1','1','0','0','390','3510','0','','0','0.00','0','0','0','0'); -- id=5403
UPDATE sellbilldetail SET  lastbuyprice = 359.00 , meanbuyprice = 359.00, lastbuyprice_withDiscount = 359.00, meanbuyprice_withDiscount = 359.00
        , lastbuyprice_withTax = 359, meanbuyprice_withTax = 359, lastbuyprice_withDiscountAndTax = 359
                where sellbilldetailid = 5403;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1885, '2026-10-22', 3510, 3231, 3231
                    , 3231, 3231, 3231, 3231
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3231, 3231, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3231
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3231, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3231
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3231, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3231
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3231
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3231
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3231
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3510, 3231, 3231
                    , 3231, 3231, 3231, 3231
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3231, 3231, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3510, sellCostBuyPrice =sellCostBuyPrice+3231
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3231, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3231
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3231, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3231
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3231
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3231
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3231
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '3', storedetaildate = '2026-10-22 17:31:29' WHERE storedetailid = '2902';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1885', '1', '9', '1', '1357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '37', '28', '3', '2026-10-22 17:31:29','0','0'); -- id=17042
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1357', '207', '2381', '6', '470', '2820', '0', '', '0', '2026-10-22 17:31:29', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-6,','1','1','0','0','470','2820','0','','0','0.00','0','0','0','0'); -- id=5404
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5404;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2820, 2700, 2700
                    , 2700, 2700, 2700, 2700
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2820, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2700, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2700
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2700
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '281', userid = '3', storedetaildate = '2026-10-22 17:31:29' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '6', '1', '1357', 'اضافة فاتورة مبيعات', 'sellbillController.php', '287', '281', '3', '2026-10-22 17:31:29','0','0'); -- id=17043
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8713036',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8700451','12585', '0', '2', 'اضافة فاتورة مبيعات', '1357', '8713036', '2026-10-22 17:31:29', '3',  'sellbillController.php','1','','0'); -- id=1667
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '12585', '12585', '2026-10-22', '3', '0', '0', '2026-10-22 17:31:29','اضافة فاتورة مبيعات رقم 1357','1','0',null,'0','1357','sellbillController.php?do=showDetail&sellbillid=1357'); -- id=4645
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4645', '419', '12585', '','0'); -- id=4775
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8713035.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4645', '143', '12585', '','0'); -- id=4647
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15351365', 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 ( '11748.15', '11748.15', '2026-10-22', '3', '0', '0', '2026-10-22 17:31:29','اضافة فاتورة مبيعات رقم 1357 - صرف البضاعة من المخزن','1','0',null,'0','1357','sellbillController.php?do=showDetail&sellbillid=1357'); -- id=4646
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4646', '402', '11748.15', '','0'); -- id=4776
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14202246.16', 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 ('4646', '382', '11748.15', '','0'); -- id=4648
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27324763.04', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
update sellbill set dailyentryid='4645,0,4646' where sellbillid=1357;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 12585, 12186, 12186
                    , 12186, 11748.15, 11748.15, 11742.39
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12186, 12186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12585, sellCostBuyPrice =sellCostBuyPrice+12186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11748.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11748.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11742.39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12585, 12186, 12186
                    , 12186, 11748.15, 11748.15, 11742.39
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,12186, 12186, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12585, sellCostBuyPrice =sellCostBuyPrice+12186
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12186, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12186
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+11748.15, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+11748.15
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+11742.39
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12186
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12186
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 12585, 12186, 12186
                    , 12186, 11748.15, 11748.15, 11742.39, 12186, 12186)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+12585, netSellCostBuyPrice = netSellCostBuyPrice+12186
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+12186
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+12186
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+11748.15
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+11748.15
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+11742.39
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+12186
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+12186;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada174d0983f and sellbillId = 1357 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:01:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:31:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:31:29', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18812
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:32:05', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18813
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:07", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:32:07', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18814
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:32:25', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18815
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:26";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:32:26', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18816
UPDATE user SET loginip = "" WHERE userid = 7;
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:32:30', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18817
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:30";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:32:30', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18818
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:32:32', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18819
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:32:35', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18820
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 17:32:51', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18821
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:02:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:32:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 17:32:56', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18822
UPDATE product SET productName = 'موديلات 340  القبطان ', productDescription = '', productCatId = '196', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-19', conditions = '0', userId = '7', limitamount = '0', parcode = '02251',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340.00',lastbuyprice_withDiscount = '306',meanbuyprice = '340.00',meanbuyprice_withDiscount = '323' , productbuypricereal = '430.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='306',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='340',meanbuyprice_withTax='170',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='306',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2251';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2251, 1,'2026-10-22 17:34:10',7)
                ON DUPLICATE KEY UPDATE productid = 2251, edited = 1, sysdate = '2026-10-22 17:34:10', userid = 7; -- id=3275
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:34:11', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18823
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:34:28', '1', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=143'); -- id=18824
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 17:34:33', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18825
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:34:38', '1', 'details', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=details&id=288'); -- id=18826
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:39", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:34:39', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18827
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('نص سوستة القبطان','','196','360','360','0','0','2026-10-22','0','7','0','','0','0','0','0','0','360','360','360','360','360','0','0','0','0','.','0','0','0','360','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','360','360','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','360','0','0','0','0','0','0','','','0','0','0','0'); -- id=2460
UPDATE product SET productName = 'نص سوستة القبطان', productDescription = '', productCatId = '196', productBuyPrice = '360', productSellAllPrice = '360', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02460',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2460';
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', '2460', '1.00', '2026-10-22', '7', '0','0246001','360','0','0','360','','0','0','0','0','0','0','0','0','0','0'); -- id=2460
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2460', '1', '0', '7', '2026-10-22'); -- id=3855
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2460', '1', '0', '0', '2460', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17044
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2460, 1,'2026-10-22 17:34:39',7)
                ON DUPLICATE KEY UPDATE productid = 2460, edited = 1, sysdate = '2026-10-22 17:34:39', userid = 7; -- id=3678
UPDATE product SET productName = 'نص سوستة القبطان', productDescription = '', productCatId = '196', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02460',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '360',meanbuyprice = '360',meanbuyprice_withDiscount = '360' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='360',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2460';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:34:41', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18828
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:34:42', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18829
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 17:34:43', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18830
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:04:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:34:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 17:34:53', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=18831
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:05:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:35:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 17:35:13', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18832
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:05:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:35:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 17:35:28', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18833
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:05:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:35:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:35:46', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18834

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada1c8ba6bfb
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada1c8ba6bfb and sellbillId = 1358 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:05:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:35:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:35:46', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18835
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:06:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:36:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:36:06', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18836
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 ('06ada1f024fde4', '2026-10-22 17:34:42', '193', '73638.00', '95292', '10', '1', '24060.00',  '21654.00', '0', '21654', '1', '2026-10-22 17:36:06', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=350
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 ('02251', '350', '196', '2251', '39', '340', '13260.00', '0', '', '2026-10-22 17:36:06', '2251','','','0','0','0','0','0',null,'340','13260','0','0','0','0','0','0','0','0','1'); -- id=1835
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:34:42', 1, 2251, 0, 0
                    , 306, 39, 0, 0, 7, '2026-10-22 17:36:06')
                ON DUPLICATE KEY UPDATE buyprice = 306,
                        buyQuantity =buyQuantity+39, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 17:36:06' ; -- id=7167
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2251', '340', '39', '0', 'buyBillController.php', '1835', '', '0', '0'); -- id=1375
UPDATE product SET  productBuyPrice = "340" WHERE productId = 2251 ;
UPDATE buybilldetail SET  quantitybefore = 36 WHERE buybilldetailid = 1835 ;
UPDATE product SET productName = 'موديلات 340  القبطان ', productDescription = '', productCatId = '196', productBuyPrice = '340.00', productSellAllPrice = '340.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-19', conditions = '0', userId = '7', limitamount = '0', parcode = '02251',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '340',lastbuyprice_withDiscount = '306',meanbuyprice = '340',meanbuyprice_withDiscount = '314.16' , productbuypricereal = '430.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='306',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='340',meanbuyprice_withTax='258.4',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='306',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2251';
UPDATE buybilldetail SET  lastbuyprice = 340 , meanbuyprice = 340, lastbuyprice_withDiscount = 306, meanbuyprice_withDiscount = 314.16
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 258.4, lastbuyprice_withDiscountAndTax = 306
                where buybilldetailid = 1835;
UPDATE productunit SET proUnitBuyPrice  = 340 * productnumber WHERE productid = 2251;
UPDATE storedetail SET  productquantity = '75', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3642';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2251', '1', '39', '0', '350', 'اضافة فاتورة مشتريات', 'buyBillController.php', '36', '75', '7', '2026-10-22 17:34:42','0','0'); -- id=17046
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 ('02460', '350', '196', '2460', '30', '360', '10800.00', '0', '', '2026-10-22 17:36:06', '2460','','','0','0','0','0','0',null,'360','10800','0','0','0','0','0','0','0','0','1'); -- id=1836
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:34:42', 1, 2460, 0, 0
                    , 324, 30, 0, 0, 7, '2026-10-22 17:36:06')
                ON DUPLICATE KEY UPDATE buyprice = 324,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 17:36:06' ; -- id=7168
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2460', '360', '30', '0', 'buyBillController.php', '1836', '', '0', '0'); -- id=1376
UPDATE product SET  productBuyPrice = "360" WHERE productId = 2460 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1836 ;
UPDATE product SET productName = 'نص سوستة القبطان', productDescription = '', productCatId = '196', productBuyPrice = '360.00', productSellAllPrice = '360.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02460',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360',lastbuyprice_withDiscount = '324',meanbuyprice = '360',meanbuyprice_withDiscount = '324' , productbuypricereal = '360.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='360',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='360',meanbuyprice_withTax='360',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='324',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2460';
UPDATE buybilldetail SET  lastbuyprice = 360 , meanbuyprice = 360, lastbuyprice_withDiscount = 324, meanbuyprice_withDiscount = 324
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where buybilldetailid = 1836;
UPDATE productunit SET proUnitBuyPrice  = 360 * productnumber WHERE productid = 2460;
UPDATE storedetail SET  productquantity = '30', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3855';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2460', '1', '30', '0', '350', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '7', '2026-10-22 17:34:42','0','0'); -- id=17047
UPDATE supplier SET  suppliercurrentDebt = '95292',suppliercurrentDebtInCurrency= '95292' , userid = '7', supplierdate = '2026-10-22 17:36:06'   WHERE supplierid = '193';
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 ('193', '73638.00', '21654', '0', 'اضافة فاتورة مشتريات', '350', '95292', '2026-10-22 17:34:42', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','21654','1','73638','21654','95292','0',''); -- id=903
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21654', '21654', '2026-10-22', '7', '0', '0', '2026-10-22 17:36:06','اضافة فاتورة مشتريات رقم 350','1','0',null,'0','350','buyBillController.php?do=details&id=350'); -- id=4649
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4649', '382', '21654', '','0'); -- id=4779
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27344834.64', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4649', '680', '21654', '','0'); -- id=4651
UPDATE accountstree SET name = 'القبطان تي شيرت', customName = 'القبطان تي شيرت', customNameEn = 'القبطان تي شيرت', nameEn = 'القبطان تي شيرت', parent = '81', accountNature = '1', theValue = '95292', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-19 17:25:24' WHERE id = '680';
update buybill set dailyentryid='4649,0' where buybillid=350;
COMMIT;
UPDATE product SET overAllAveragePrice = 306 WHERE productId = 2251;UPDATE product SET overAllAveragePrice = 324 WHERE productId = 2460;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:06:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:36:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:36:06', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=350'); -- id=18837
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:06:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:36:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:36:11', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=350&type=2'); -- id=18838
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:07:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:37:18", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 17:37:18', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18839
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:07:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:37:26", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:37:26', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1355'); -- id=18840
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:09:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:39:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:39:22', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18841
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:09:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:39:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:39:44', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18842
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:10:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:40:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:40:25', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18843
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:11:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:41:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:41:18', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18844
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 ('06ada205979cbe', '2026-10-22 17:40:25', '44', '340110.00', '378710', '0', '0', '38600.00',  '38600.00', '0', '38600', '1', '2026-10-22 17:41:18', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=351
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 ('01980', '351', '37', '1980', '40', '530', '21200.00', '0', '', '2026-10-22 17:41:18', '1980','','','0','0','0','0','0',null,'530','21200','0','0','0','0','0','0','0','0','1'); -- id=1837
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:40:25', 1, 1980, 0, 0
                    , 530, 40, 0, 0, 7, '2026-10-22 17:41:18')
                ON DUPLICATE KEY UPDATE buyprice = 530,
                        buyQuantity =buyQuantity+40, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 17:41:18' ; -- id=7169
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1980', '530', '40', '0', 'buyBillController.php', '1837', '', '0', '0'); -- id=1377
UPDATE product SET  productBuyPrice = "530" WHERE productId = 1980 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1837 ;
UPDATE product SET productName = 'دربي جلد 2011 ميلانو', productDescription = '', productCatId = '37', productBuyPrice = '530.00', productSellAllPrice = '550.00', productSellUnitPrice = '550.00', productSellHalfPrice = '550.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '01980',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '530',lastbuyprice_withDiscount = '530',meanbuyprice = '530',meanbuyprice_withDiscount = '530' , productbuypricereal = '530.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.77' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='530',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='530',meanbuyprice_withTax='530',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='530',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1980';
UPDATE buybilldetail SET  lastbuyprice = 530 , meanbuyprice = 530, lastbuyprice_withDiscount = 530, meanbuyprice_withDiscount = 530
        , lastbuyprice_withTax = 530, meanbuyprice_withTax = 530, lastbuyprice_withDiscountAndTax = 530
                where buybilldetailid = 1837;
UPDATE productunit SET proUnitBuyPrice  = 530 * productnumber WHERE productid = 1980;
UPDATE storedetail SET  productquantity = '40', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2997';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1980', '1', '40', '0', '351', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '40', '7', '2026-10-22 17:40:25','0','0'); -- id=17048
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 ('01979', '351', '37', '1979', '30', '580', '17400.00', '0', '', '2026-10-22 17:41:18', '1979','','','0','0','0','0','0',null,'580','17400','0','0','0','0','0','0','0','0','1'); -- id=1838
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:40:25', 1, 1979, 0, 0
                    , 580, 30, 0, 0, 7, '2026-10-22 17:41:18')
                ON DUPLICATE KEY UPDATE buyprice = 580,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 17:41:18' ; -- id=7170
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1979', '580', '30', '0', 'buyBillController.php', '1838', '', '0', '0'); -- id=1378
UPDATE product SET  productBuyPrice = "580" WHERE productId = 1979 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1838 ;
UPDATE product SET productName = 'اميري فوطة حروف 2026 ميلانو', productDescription = '', productCatId = '37', productBuyPrice = '580.00', productSellAllPrice = '600.00', productSellUnitPrice = '600.00', productSellHalfPrice = '600.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '01979',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '580',lastbuyprice_withDiscount = '580',meanbuyprice = '580',meanbuyprice_withDiscount = '580' , productbuypricereal = '580.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.45' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='580',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='580',meanbuyprice_withTax='580',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='580',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1979';
UPDATE buybilldetail SET  lastbuyprice = 580 , meanbuyprice = 580, lastbuyprice_withDiscount = 580, meanbuyprice_withDiscount = 580
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where buybilldetailid = 1838;
UPDATE productunit SET proUnitBuyPrice  = 580 * productnumber WHERE productid = 1979;
UPDATE storedetail SET  productquantity = '30', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2996';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1979', '1', '30', '0', '351', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '7', '2026-10-22 17:40:25','0','0'); -- id=17049
UPDATE supplier SET  suppliercurrentDebt = '378710',suppliercurrentDebtInCurrency= '378710' , userid = '7', supplierdate = '2026-10-22 17:41:18'   WHERE supplierid = '44';
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 ('44', '340110.00', '38600', '0', 'اضافة فاتورة مشتريات', '351', '378710', '2026-10-22 17:40:25', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','38600','1','340110','38600','378710','0',''); -- id=904
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '38600', '38600', '2026-10-22', '7', '0', '0', '2026-10-22 17:41:18','اضافة فاتورة مشتريات رقم 351','1','0',null,'0','351','buyBillController.php?do=details&id=351'); -- id=4650
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4650', '382', '38600', '','0'); -- id=4780
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27383434.64', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4650', '463', '38600', '','0'); -- id=4652
UPDATE accountstree SET name = 'ميلانو - مورد', customName = 'ميلانو - مورد', customNameEn = 'ميلانو - مورد', nameEn = 'ميلانو - مورد', parent = '81', accountNature = '1', theValue = '116400', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '463';
update buybill set dailyentryid='4650,0' where buybillid=351;
COMMIT;
UPDATE product SET overAllAveragePrice = 580 WHERE productId = 1979;UPDATE product SET overAllAveragePrice = 530 WHERE productId = 1980;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:11:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:41:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:41:18', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=351'); -- id=18845
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:11:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:41:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:41:23', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=351&type=2'); -- id=18846
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:30", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 17:45:30', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18847
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:32", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:45:32', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18848
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2026-10-22 17:45:39', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyreport.php'); -- id=18849
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:45:40', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18850
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 17:45:43', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18851
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:15:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:45:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:45:55', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18852
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:46:05', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18853
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:46:27', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18854
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:27";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:46:27', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18855
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:46:29', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18856
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:46:38', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18857
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:49", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:46:49', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18858

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada218d05972
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada218d05972 and sellbillId = 1359 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:16:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:46:50", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:46:50', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18859
UPDATE product SET productName = 'كود 1014 برو', productDescription = '', productCatId = '158', productBuyPrice = '600.00', productSellAllPrice = '600.00', productSellUnitPrice = '600.00', productSellHalfPrice = '600.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '01952',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '600.00',lastbuyprice_withDiscount = '552',meanbuyprice = '600.00',meanbuyprice_withDiscount = '552' , productbuypricereal = '570.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.26' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='552',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='600',meanbuyprice_withTax='600',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='552',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1952';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1952, 1,'2026-10-22 17:47:11',1)
                ON DUPLICATE KEY UPDATE productid = 1952, edited = 1, sysdate = '2026-10-22 17:47:11', userid = 1; -- id=2893
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:17:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:47:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:47:17', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18860
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:17:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:47:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:47:58', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18861
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:17:59";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:47:59', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18862
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:18:02";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:48:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:48:02', '1', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18863
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:19:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:49:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:49:36', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18864
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 ('06ada2222ad3ef', '2026-10-22 17:48:02', '161', '395535.00', '449619', '0', '0', '54084.00',  '54084.00', '0', '54084', '1', '2026-10-22 17:49:36', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=352
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 ('02359', '352', '147', '2359', '72', '394', '28368.00', '0', '', '2026-10-22 17:49:36', '2359','','','0','0','0','0','0',null,'394','28368','0','0','0','0','0','0','0','0','1'); -- id=1839
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:48:02', 1, 2359, 0, 0
                    , 394, 72, 0, 0, 1, '2026-10-22 17:49:36')
                ON DUPLICATE KEY UPDATE buyprice = 394,
                        buyQuantity =buyQuantity+72, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 17:49:36' ; -- id=7171
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2359', '394', '72', '0', 'buyBillController.php', '1839', '', '0', '0'); -- id=1379
UPDATE product SET  productBuyPrice = "394" WHERE productId = 2359 ;
UPDATE buybilldetail SET  quantitybefore = 24 WHERE buybilldetailid = 1839 ;
UPDATE product SET productName = 'بوكس فيت دبل سوسته الالماني', productDescription = '', productCatId = '147', productBuyPrice = '394.00', productSellAllPrice = '425.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-21', conditions = '0', userId = '1', limitamount = '0', parcode = '02359',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '394',lastbuyprice_withDiscount = '394',meanbuyprice = '394',meanbuyprice_withDiscount = '394' , productbuypricereal = '394.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.87' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='394',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='394',meanbuyprice_withTax='394',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='394',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2359';
UPDATE buybilldetail SET  lastbuyprice = 394 , meanbuyprice = 394, lastbuyprice_withDiscount = 394, meanbuyprice_withDiscount = 394
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where buybilldetailid = 1839;
UPDATE productunit SET proUnitBuyPrice  = 394 * productnumber WHERE productid = 2359;
UPDATE storedetail SET  productquantity = '96', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '72', '0', '352', 'اضافة فاتورة مشتريات', 'buyBillController.php', '24', '96', '1', '2026-10-22 17:48:02','0','0'); -- id=17051
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 ('01886', '352', '147', '1886', '36', '289', '10404.00', '0', '', '2026-10-22 17:49:36', '1886','','','0','0','0','0','0',null,'289','10404','0','0','0','0','0','0','0','0','1'); -- id=1840
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:48:02', 1, 1886, 0, 0
                    , 289, 36, 0, 0, 1, '2026-10-22 17:49:36')
                ON DUPLICATE KEY UPDATE buyprice = 289,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 17:49:36' ; -- id=7172
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1886', '289', '36', '0', 'buyBillController.php', '1840', '', '0', '0'); -- id=1380
UPDATE product SET  productBuyPrice = "289" WHERE productId = 1886 ;
UPDATE buybilldetail SET  quantitybefore = 52 WHERE buybilldetailid = 1840 ;
UPDATE product SET productName = 'بوكس فيت بيزك الالماني', productDescription = '', productCatId = '147', productBuyPrice = '289.00', productSellAllPrice = '320.00', productSellUnitPrice = '320.00', productSellHalfPrice = '320.00', productDate = '2026-10-12', conditions = '0', userId = '1', limitamount = '0', parcode = '01886',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '289',lastbuyprice_withDiscount = '289',meanbuyprice = '289',meanbuyprice_withDiscount = '289' , productbuypricereal = '289.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '10.73' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='289',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='289',meanbuyprice_withTax='289',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='289',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1886';
UPDATE buybilldetail SET  lastbuyprice = 289 , meanbuyprice = 289, lastbuyprice_withDiscount = 289, meanbuyprice_withDiscount = 289
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where buybilldetailid = 1840;
UPDATE productunit SET proUnitBuyPrice  = 289 * productnumber WHERE productid = 1886;
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '36', '0', '352', 'اضافة فاتورة مشتريات', 'buyBillController.php', '52', '88', '1', '2026-10-22 17:48:02','0','0'); -- id=17052
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 ('01889', '352', '147', '1889', '48', '319', '15312.00', '0', '', '2026-10-22 17:49:36', '1889','','','0','0','0','0','0',null,'319','15312','0','0','0','0','0','0','0','0','1'); -- id=1841
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:48:02', 1, 1889, 0, 0
                    , 319, 48, 0, 0, 1, '2026-10-22 17:49:36')
                ON DUPLICATE KEY UPDATE buyprice = 319,
                        buyQuantity =buyQuantity+48, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 17:49:36' ; -- id=7173
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1889', '319', '48', '0', 'buyBillController.php', '1841', '', '0', '0'); -- id=1381
UPDATE product SET  productBuyPrice = "319" WHERE productId = 1889 ;
UPDATE buybilldetail SET  quantitybefore = 111 WHERE buybilldetailid = 1841 ;
UPDATE product SET productName = 'رجالي دوبل زنط الالماني', productDescription = '', productCatId = '147', productBuyPrice = '319.00', productSellAllPrice = '350.00', productSellUnitPrice = '350.00', productSellHalfPrice = '350.00', productDate = '2026-10-12', conditions = '0', userId = '1', limitamount = '0', parcode = '01889',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '319',lastbuyprice_withDiscount = '319',meanbuyprice = '319',meanbuyprice_withDiscount = '319' , productbuypricereal = '319.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '9.72' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='319',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='319',meanbuyprice_withTax='319',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='319',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1889';
UPDATE buybilldetail SET  lastbuyprice = 319 , meanbuyprice = 319, lastbuyprice_withDiscount = 319, meanbuyprice_withDiscount = 319
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where buybilldetailid = 1841;
UPDATE productunit SET proUnitBuyPrice  = 319 * productnumber WHERE productid = 1889;
UPDATE storedetail SET  productquantity = '159', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '48', '0', '352', 'اضافة فاتورة مشتريات', 'buyBillController.php', '111', '159', '1', '2026-10-22 17:48:02','0','0'); -- id=17053
UPDATE supplier SET  suppliercurrentDebt = '449619',suppliercurrentDebtInCurrency= '449619' , userid = '1', supplierdate = '2026-10-22 17:49:36'   WHERE supplierid = '161';
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 ('161', '395535.00', '54084', '0', 'اضافة فاتورة مشتريات', '352', '449619', '2026-10-22 17:48:02', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','54084','1','395535','54084','449619','0',''); -- id=905
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '54084', '54084', '2026-10-22', '1', '0', '0', '2026-10-22 17:49:36','اضافة فاتورة مشتريات رقم 352','1','0',null,'0','352','buyBillController.php?do=details&id=352'); -- id=4653
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4653', '382', '54084', '','0'); -- id=4783
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27435218.64', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4653', '644', '54084', '','0'); -- id=4655
UPDATE accountstree SET name = 'الالماني', customName = 'الالماني', customNameEn = 'الالماني', nameEn = 'الالماني', parent = '81', accountNature = '1', theValue = '449619', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 18:57:07' WHERE id = '644';
update buybill set dailyentryid='4653,0' where buybillid=352;
COMMIT;
UPDATE product SET overAllAveragePrice = 289 WHERE productId = 1886;UPDATE product SET overAllAveragePrice = 319 WHERE productId = 1889;UPDATE product SET overAllAveragePrice = 394 WHERE productId = 2359;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:19:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:49:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:49:36', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=352'); -- id=18865
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:19:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:49:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:49:44', '1', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=352&type=2'); -- id=18866
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:21:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:51:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:51:17', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18867
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:21:17";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 17:51:17", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:51:17', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18868
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:21:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:51:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:51:19', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18869
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:21:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:51:24", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:51:24', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18870

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada1f42eabe2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:51:24', '06ada1f42eabe2', '1', '0.00', '0', '0', '1', '25965.00', '25965', '25965', '0', '1', '2026-10-22 17:51:24', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '72' ,'0','','','','','-1','0','0','0','0','0','25965','0','','0','0','25965','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1360
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1360', '0', '2026-10-22 17:51:24', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '25965', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:51:24','0','0','',''); -- id=1596
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 983;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('319','01889', '1360', '147', '1889', '9', '350', '3150', '0', '', '0', '2026-10-22 17:51:24', '1889', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','983-9,','1','1','0','0','350','3150','0','','0','0.00','0','0','0','0'); -- id=5407
UPDATE sellbilldetail SET  lastbuyprice = 319.00 , meanbuyprice = 319.00, lastbuyprice_withDiscount = 319.00, meanbuyprice_withDiscount = 319.00
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where sellbilldetailid = 5407;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1889, '2026-10-22', 3150, 2871, 2871
                    , 2871, 2871, 2871, 2871
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2871, 2871, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+2871
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2871, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2871
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2871, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2871
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2871
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2871
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2871
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3150, 2871, 2871
                    , 2871, 2871, 2871, 2871
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2871, 2871, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3150, sellCostBuyPrice =sellCostBuyPrice+2871
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2871, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2871
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2871, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2871
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2871
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2871
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2871
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '150', userid = '2', storedetaildate = '2026-10-22 17:51:24' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '9', '1', '1360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '159', '150', '2', '2026-10-22 17:51:24','0','0'); -- id=17054
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+18 where id = 982;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('269','01888', '1360', '147', '1888', '18', '300', '5400', '0', '', '0', '2026-10-22 17:51:24', '1888', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','982-18,','1','1','0','0','300','5400','0','','0','0.00','0','0','0','0'); -- id=5408
UPDATE sellbilldetail SET  lastbuyprice = 269.00 , meanbuyprice = 269.00, lastbuyprice_withDiscount = 269.00, meanbuyprice_withDiscount = 269.00
        , lastbuyprice_withTax = 269, meanbuyprice_withTax = 269, lastbuyprice_withDiscountAndTax = 269
                where sellbilldetailid = 5408;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1888, '2026-10-22', 5400, 4842, 4842
                    , 4842, 4842, 4842, 4842
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 4842, 4842, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+4842
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4842, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4842
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4842, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4842
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4842
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4842
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4842
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5400, 4842, 4842
                    , 4842, 4842, 4842, 4842
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4842, 4842, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5400, sellCostBuyPrice =sellCostBuyPrice+4842
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4842, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4842
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4842, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4842
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4842
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4842
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4842
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '324', userid = '2', storedetaildate = '2026-10-22 17:51:24' WHERE storedetailid = '2905';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1888', '1', '18', '1', '1360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '342', '324', '2', '2026-10-22 17:51:24','0','0'); -- id=17055
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1360', '147', '1887', '21', '410', '8610', '0', '', '0', '2026-10-22 17:51:24', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-21,','1','1','0','0','410','8610','0','','0','0.00','0','0','0','0'); -- id=5409
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 5409;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 8610, 7959, 7959
                    , 7959, 7959, 7959, 7959
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 7959, 7959, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8610, sellCostBuyPrice =sellCostBuyPrice+7959
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7959, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7959
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7959, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7959
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7959
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7959
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8610, 7959, 7959
                    , 7959, 7959, 7959, 7959
                    , 0, 0, 0, 0
                    , 0, 0, 0, 7959, 7959, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8610, sellCostBuyPrice =sellCostBuyPrice+7959
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7959, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7959
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7959, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7959
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7959
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+7959
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+7959
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '240', userid = '2', storedetaildate = '2026-10-22 17:51:24' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '21', '1', '1360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '261', '240', '2', '2026-10-22 17:51:24','0','0'); -- id=17056
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1360', '166', '2028', '9', '320', '2880', '0', '', '0', '2026-10-22 17:51:24', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-9,','1','1','0','0','320','2880','0','','0','0.00','0','0','0','0'); -- id=5410
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5410;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2880, 2880, 2880
                    , 2880, 2678.4, 2678.4, 2672.64
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2880, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2678.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2678.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2672.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '72', userid = '2', storedetaildate = '2026-10-22 17:51:24' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '9', '1', '1360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '81', '72', '2', '2026-10-22 17:51:24','0','0'); -- id=17057
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 985;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('364','01891', '1360', '147', '1891', '15', '395', '5925', '0', '', '0', '2026-10-22 17:51:24', '1891', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','985-15,','1','1','0','0','395','5925','0','','0','0.00','0','0','0','0'); -- id=5411
UPDATE sellbilldetail SET  lastbuyprice = 364.00 , meanbuyprice = 364.00, lastbuyprice_withDiscount = 364.00, meanbuyprice_withDiscount = 364.00
        , lastbuyprice_withTax = 364, meanbuyprice_withTax = 364, lastbuyprice_withDiscountAndTax = 364
                where sellbilldetailid = 5411;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1891, '2026-10-22', 5925, 5460, 5460
                    , 5460, 5460, 5460, 5460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5460, 5460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5925, 5460, 5460
                    , 5460, 5460, 5460, 5460
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5460, 5460, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5925, sellCostBuyPrice =sellCostBuyPrice+5460
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5460, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5460
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5460, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5460
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5460
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5460
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5460
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '174', userid = '2', storedetaildate = '2026-10-22 17:51:24' WHERE storedetailid = '2908';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1891', '1', '15', '1', '1360', 'اضافة فاتورة مبيعات', 'sellbillController.php', '189', '174', '2', '2026-10-22 17:51:24','0','0'); -- id=17058
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8740721',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8714756','25965', '0', '2', 'اضافة فاتورة مبيعات', '1360', '8740721', '2026-10-22 17:51:24', '2',  'sellbillController.php','1','','0'); -- id=1670
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '25965', '25965', '2026-10-22', '2', '0', '0', '2026-10-22 17:51:24','اضافة فاتورة مبيعات رقم 1360','1','0',null,'0','1360','sellbillController.php?do=showDetail&sellbillid=1360'); -- id=4654
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4654', '419', '25965', '','0'); -- id=4784
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8740720.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4654', '143', '25965', '','0'); -- id=4656
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15382025', 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 ( '23810.4', '23810.4', '2026-10-22', '2', '0', '0', '2026-10-22 17:51:24','اضافة فاتورة مبيعات رقم 1360 - صرف البضاعة من المخزن','1','0',null,'0','1360','sellbillController.php?do=showDetail&sellbillid=1360'); -- id=4655
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4655', '402', '23810.4', '','0'); -- id=4785
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14229938.96', 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 ('4655', '382', '23810.4', '','0'); -- id=4657
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27411408.24', 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='4654,0,4655' where sellbillid=1360;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 25965, 24012, 24012
                    , 24012, 23810.4, 23810.4, 23804.64
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24012, 24012, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25965, sellCostBuyPrice =sellCostBuyPrice+24012
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24012, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24012
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23810.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23810.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23804.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24012
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24012
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 25965, 24012, 24012
                    , 24012, 23810.4, 23810.4, 23804.64
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,24012, 24012, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+25965, sellCostBuyPrice =sellCostBuyPrice+24012
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+24012, sellCostMeanBuyPrice = sellCostMeanBuyPrice+24012
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+23810.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+23810.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+23804.64
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+24012
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+24012
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 25965, 24012, 24012
                    , 24012, 23810.4, 23810.4, 23804.64, 24012, 24012)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+25965, netSellCostBuyPrice = netSellCostBuyPrice+24012
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+24012
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+24012
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+23810.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+23810.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+23804.64
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+24012
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+24012;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada1f42eabe2 and sellbillId = 1360 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:21:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:51:24", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:51:24', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18871
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:22:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:52:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:52:12', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18872
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:22:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:52:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:52:22', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18873
UPDATE product SET productName = 'موديلات 5890 رياكشن', productDescription = '', productCatId = '137', productBuyPrice = '550.00', productSellAllPrice = '590.00', productSellUnitPrice = '590.00', productSellHalfPrice = '590.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01764',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550.00',lastbuyprice_withDiscount = '550',meanbuyprice = '550.00',meanbuyprice_withDiscount = '550' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.27' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1764';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1764, 1,'2026-10-22 17:53:34',7)
                ON DUPLICATE KEY UPDATE productid = 1764, edited = 1, sysdate = '2026-10-22 17:53:34', userid = 7; -- id=2668
UPDATE product SET productName = 'موديلات 590 رياكشن', productDescription = '', productCatId = '137', productBuyPrice = '550.00', productSellAllPrice = '590.00', productSellUnitPrice = '590.00', productSellHalfPrice = '590.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01764',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550.00',lastbuyprice_withDiscount = '550',meanbuyprice = '550.00',meanbuyprice_withDiscount = '550' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.27' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1764';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1764, 1,'2026-10-22 17:54:03',7)
                ON DUPLICATE KEY UPDATE productid = 1764, edited = 1, sysdate = '2026-10-22 17:54:03', userid = 7; -- id=2668
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:06", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:54:06', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18874
UPDATE product SET productName = 'موديل 704 رياكشن', productDescription = '', productCatId = '137', productBuyPrice = '920.00', productSellAllPrice = '990.00', productSellUnitPrice = '990.00', productSellHalfPrice = '990.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01765',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '920.00',lastbuyprice_withDiscount = '920',meanbuyprice = '920.00',meanbuyprice_withDiscount = '920' , productbuypricereal = '920.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.61' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='920',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='920',meanbuyprice_withTax='920',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='920',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1765';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1765, 1,'2026-10-22 17:54:07',7)
                ON DUPLICATE KEY UPDATE productid = 1765, edited = 1, sysdate = '2026-10-22 17:54:07', userid = 7; -- id=2669
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:18', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18875
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:18", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:18', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18876
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:29', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18877

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada1e41e7da3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 17:54:29', '06ada1e41e7da3', '1', '0.00', '0', '200', '1', '6775.00', '6575', '6575', '0', '1', '2026-10-22 17:54:29', '', '3', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '20' ,'0','','','','','-1','0','0','0','0','0','6575','0','','0','0','6575','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1361
UPDATE client SET  clientdebt = '0', userid = '3' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1361', '0', '2026-10-22 17:54:29', '3', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6575', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 17:54:29','0','0','',''); -- id=1597
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1361', '190', '2176', '3', '330', '990', '0', '', '0', '2026-10-22 17:54:29', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5412
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5412;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 960.77490774908, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960.77490774908, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960.77490774908, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960.77490774908, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '62', userid = '3', storedetaildate = '2026-10-22 17:54:29' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '3', '1', '1361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '65', '62', '3', '2026-10-22 17:54:29','0','0'); -- id=17059
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7097;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('230','02175', '1361', '190', '2175', '8', '245', '1960', '0', '', '0', '2026-10-22 17:54:29', '2175', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7097-8,','1','1','0','0','245','1960','0','','0','0.00','0','0','0','0'); -- id=5413
UPDATE sellbilldetail SET  lastbuyprice = 230.00 , meanbuyprice = 230.00, lastbuyprice_withDiscount = 230.00, meanbuyprice_withDiscount = 230.00
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 230
                where sellbilldetailid = 5413;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2175, '2026-10-22', 1902.1402214022, 1840, 1840
                    , 1840, 1840, 1840, 1840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 1840, 1840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1902.1402214022, sellCostBuyPrice =sellCostBuyPrice+1840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1902.1402214022, 1840, 1840
                    , 1840, 1840, 1840, 1840
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1840, 1840, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1902.1402214022, sellCostBuyPrice =sellCostBuyPrice+1840
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1840
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1840
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1840
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1840
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1840
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '28', userid = '3', storedetaildate = '2026-10-22 17:54:29' WHERE storedetailid = '3535';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2175', '1', '8', '1', '1361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '28', '3', '2026-10-22 17:54:29','0','0'); -- id=17060
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','i0002359', '1361', '147', '2359', '9', '425', '3825', '0', '', '0', '2026-10-22 17:54:29', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-9,','1','1','0','0','425','3825','0','','0','0.00','0','0','0','0'); -- id=5414
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5414;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 3712.0848708487, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3712.0848708487, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3712.0848708487, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3712.0848708487, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '87', userid = '3', storedetaildate = '2026-10-22 17:54:29' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '9', '1', '1361', 'اضافة فاتورة مبيعات', 'sellbillController.php', '96', '87', '3', '2026-10-22 17:54:29','0','0'); -- id=17061
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8747296',  userid = '3' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8740721','6575', '0', '2', 'اضافة فاتورة مبيعات', '1361', '8747296', '2026-10-22 17:54:29', '3',  'sellbillController.php','1','','0'); -- id=1671
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6775', '6775', '2026-10-22', '3', '0', '0', '2026-10-22 17:54:29','اضافة فاتورة مبيعات رقم 1361','1','0',null,'0','1361','sellbillController.php?do=showDetail&sellbillid=1361'); -- id=4656
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4656', '419', '6575', '','0'); -- id=4786
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8747295.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4656', '398', '200', '','0'); -- id=4787
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '512356.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4656', '143', '6775', '','0'); -- id=4658
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15388800', 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 ( '6316', '6316', '2026-10-22', '3', '0', '0', '2026-10-22 17:54:29','اضافة فاتورة مبيعات رقم 1361 - صرف البضاعة من المخزن','1','0',null,'0','1361','sellbillController.php?do=showDetail&sellbillid=1361'); -- id=4657
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4657', '402', '6316', '','0'); -- id=4788
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14236254.96', 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 ('4657', '382', '6316', '','0'); -- id=4659
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27405092.24', 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='4656,0,4657' where sellbillid=1361;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6575, 6316, 6316
                    , 6316, 6316, 6316, 6316
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6316, 6316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6575, sellCostBuyPrice =sellCostBuyPrice+6316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6316, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6316
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6575, 6316, 6316
                    , 6316, 6316, 6316, 6316
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6316, 6316, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6575, sellCostBuyPrice =sellCostBuyPrice+6316
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6316, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6316
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6316, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6316
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6316
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6316
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6316
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 6575, 6316, 6316
                    , 6316, 6316, 6316, 6316, 6316, 6316)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6575, netSellCostBuyPrice = netSellCostBuyPrice+6316
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6316
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6316
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6316
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6316
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6316
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6316
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6316;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada1e41e7da3 and sellbillId = 1361 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:29', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18878
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:54:35', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18879
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 ('06ada238f00c60', '2026-10-22 17:54:07', '132', '314000.00', '331600', '0', '0', '17600.00',  '17600.00', '0', '17600', '1', '2026-10-22 17:54:35', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=353
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 ('01764', '353', '137', '1764', '32', '550', '17600.00', '0', '', '2026-10-22 17:54:35', '1764','','','0','0','0','0','0',null,'550','17600','0','0','0','0','0','0','0','0','1'); -- id=1842
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 17:54:07', 1, 1764, 0, 0
                    , 550, 32, 0, 0, 7, '2026-10-22 17:54:35')
                ON DUPLICATE KEY UPDATE buyprice = 550,
                        buyQuantity =buyQuantity+32, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 17:54:35' ; -- id=7174
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('1764', '550', '32', '0', 'buyBillController.php', '1842', '', '0', '0'); -- id=1382
UPDATE product SET  productBuyPrice = "550" WHERE productId = 1764 ;
UPDATE buybilldetail SET  quantitybefore = 36 WHERE buybilldetailid = 1842 ;
UPDATE product SET productName = 'موديلات 590 رياكشن', productDescription = '', productCatId = '137', productBuyPrice = '550.00', productSellAllPrice = '590.00', productSellUnitPrice = '590.00', productSellHalfPrice = '590.00', productDate = '2026-10-08', conditions = '0', userId = '1', limitamount = '0', parcode = '01764',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '550',lastbuyprice_withDiscount = '550',meanbuyprice = '550',meanbuyprice_withDiscount = '550' , productbuypricereal = '550.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.27' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='550',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='550',meanbuyprice_withTax='550',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='550',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '1764';
UPDATE buybilldetail SET  lastbuyprice = 550 , meanbuyprice = 550, lastbuyprice_withDiscount = 550, meanbuyprice_withDiscount = 550
        , lastbuyprice_withTax = 550, meanbuyprice_withTax = 550, lastbuyprice_withDiscountAndTax = 550
                where buybilldetailid = 1842;
UPDATE productunit SET proUnitBuyPrice  = 550 * productnumber WHERE productid = 1764;
UPDATE storedetail SET  productquantity = '68', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '2777';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1764', '1', '32', '0', '353', 'اضافة فاتورة مشتريات', 'buyBillController.php', '36', '68', '7', '2026-10-22 17:54:07','0','0'); -- id=17062
UPDATE supplier SET  suppliercurrentDebt = '331600',suppliercurrentDebtInCurrency= '331600' , userid = '7', supplierdate = '2026-10-22 17:54:35'   WHERE supplierid = '132';
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 ('132', '314000.00', '17600', '0', 'اضافة فاتورة مشتريات', '353', '331600', '2026-10-22 17:54:07', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','17600','1','314000','17600','331600','0',''); -- id=906
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17600', '17600', '2026-10-22', '7', '0', '0', '2026-10-22 17:54:35','اضافة فاتورة مشتريات رقم 353','1','0',null,'0','353','buyBillController.php?do=details&id=353'); -- id=4658
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4658', '382', '17600', '','0'); -- id=4789
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27422692.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4658', '615', '17600', '','0'); -- id=4660
UPDATE accountstree SET name = 'رياكشن', customName = 'رياكشن', customNameEn = 'رياكشن', nameEn = 'رياكشن', parent = '81', accountNature = '1', theValue = '331600', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 18:40:25' WHERE id = '615';
update buybill set dailyentryid='4658,0' where buybillid=353;
COMMIT;
UPDATE product SET overAllAveragePrice = 550 WHERE productId = 1764;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 17:54:35', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=353'); -- id=18880
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:40', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1361'); -- id=18881
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:40", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:54:40', '3', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1361'); -- id=18882
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:24:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:54:46", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:54:46', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=353&type=2'); -- id=18883
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:15";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 17:55:18', '4', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18884
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:18";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 17:55:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 17:55:18', '4', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18885
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:55:21', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18886
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:31", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:55:31', '4', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1343'); -- id=18887
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 17:55:39', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18888
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:39", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 17:55:39', '3', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18889
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:55:41', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18890
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:25:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:55:50", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 17:55:50', '3', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php?do=show'); -- id=18891
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:26:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:56:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:56:13', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18892

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada23ed18b4a
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada23ed18b4a and sellbillId = 1362 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:26:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:56:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:56:13', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18893
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:27:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:57:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:57:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18894
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:27:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:57:22", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 17:57:22', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18895
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:27:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:57:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:57:36', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18896
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:28:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:58:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:58:26', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18897
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:28:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 17:58:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 17:58:29', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18898
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:31:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:01:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:01:24', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18899
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:31:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:01:24", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:01:24', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18900
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:31:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:01:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:01:29', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18901

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada2453089c9
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada2453089c9 and sellbillId = 1363 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:31:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:01:29", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:01:29', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18902
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:33:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:03:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 18:03:12', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18903
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:33:12";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 18:03:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 18:03:12', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18904
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:33:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:03:14", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:03:14', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18905
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:33:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:03:18", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:03:18', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18906

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada22eca3986
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 18:03:18', '06ada22eca3986', '1', '0.00', '0', '75', '1', '17775.00', '17700', '17700', '0', '1', '2026-10-22 18:03:18', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '48' ,'0','','','','','-1','0','0','0','0','0','17700','0','','0','0','17700','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1364
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1364', '0', '2026-10-22 18:03:18', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17700', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 18:03:18','0','0','',''); -- id=1600
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1364', '190', '2176', '6', '330', '1980', '0', '', '0', '2026-10-22 18:03:18', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-6,','1','1','0','0','330','1980','0','','0','0.00','0','0','0','0'); -- id=5418
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5418;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 1971.6455696203, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1971.6455696203, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1971.6455696203, 1860, 1860
                    , 1860, 1860, 1860, 1860
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1860, 1860, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1971.6455696203, sellCostBuyPrice =sellCostBuyPrice+1860
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1860, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1860
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1860, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1860
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1860
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1860
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1860
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '56', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '6', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '62', '56', '2', '2026-10-22 18:03:18','0','0'); -- id=17066
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 332;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 954;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('410','01462', '1364', '103', '1462', '12', '430', '5160', '0', '', '0', '2026-10-22 18:03:18', '1462', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','332-6,954-6,','1','1','0','0','430','5160','0','','0','0.00','0','0','0','0'); -- id=5419
UPDATE sellbilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where sellbilldetailid = 5419;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1462, '2026-10-22', 5138.2278481013, 4920, 4920
                    , 4920, 4920, 4920, 4920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4920, 4920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5138.2278481013, sellCostBuyPrice =sellCostBuyPrice+4920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 5138.2278481013, 4920, 4920
                    , 4920, 4920, 4920, 4920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4920, 4920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+5138.2278481013, sellCostBuyPrice =sellCostBuyPrice+4920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '174', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '1487';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1462', '1', '12', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '186', '174', '2', '2026-10-22 18:03:18','0','0'); -- id=17067
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6990;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1364', '147', '2359', '9', '425', '3825', '0', '', '0', '2026-10-22 18:03:18', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-9,','1','1','0','0','425','3825','0','','0','0.00','0','0','0','0'); -- id=5420
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5420;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 3808.8607594937, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3808.8607594937, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3808.8607594937, 3546, 3546
                    , 3546, 3546, 3546, 3546
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3546, 3546, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3808.8607594937, sellCostBuyPrice =sellCostBuyPrice+3546
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3546, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3546
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3546, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3546
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3546
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3546
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3546
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '78', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '9', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '87', '78', '2', '2026-10-22 18:03:18','0','0'); -- id=17068
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7099;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02425', '1364', '190', '2425', '8', '320', '2560', '0', '', '0', '2026-10-22 18:03:18', '2425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7099-8,','1','1','0','0','320','2560','0','','0','0.00','0','0','0','0'); -- id=5421
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5421;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2425, '2026-10-22', 2549.1983122363, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2549.1983122363, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2549.1983122363, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2549.1983122363, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '8', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '20', '12', '2', '2026-10-22 18:03:18','0','0'); -- id=17069
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 7104;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('260','02430', '1364', '190', '2430', '4', '275', '1100', '0', '', '0', '2026-10-22 18:03:18', '2430', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7104-4,','1','1','0','0','275','1100','0','','0','0.00','0','0','0','0'); -- id=5422
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where sellbilldetailid = 5422;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2430, '2026-10-22', 1095.358649789, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1095.358649789, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1095.358649789, 1040, 1040
                    , 1040, 1040, 1040, 1040
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1040, 1040, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1095.358649789, sellCostBuyPrice =sellCostBuyPrice+1040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1040, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1040
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1040
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1040
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '3825';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2430', '1', '4', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '36', '32', '2', '2026-10-22 18:03:18','0','0'); -- id=17070
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 983;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('319','01889', '1364', '147', '1889', '9', '350', '3150', '0', '', '0', '2026-10-22 18:03:18', '1889', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','983-9,','1','1','0','0','350','3150','0','','0','0.00','0','0','0','0'); -- id=5423
UPDATE sellbilldetail SET  lastbuyprice = 319.00 , meanbuyprice = 319.00, lastbuyprice_withDiscount = 319.00, meanbuyprice_withDiscount = 319.00
        , lastbuyprice_withTax = 319, meanbuyprice_withTax = 319, lastbuyprice_withDiscountAndTax = 319
                where sellbilldetailid = 5423;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1889, '2026-10-22', 3136.7088607595, 2871, 2871
                    , 2871, 2871, 2871, 2871
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2871, 2871, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3136.7088607595, sellCostBuyPrice =sellCostBuyPrice+2871
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2871, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2871
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2871, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2871
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2871
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2871
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2871
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3136.7088607595, 2871, 2871
                    , 2871, 2871, 2871, 2871
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2871, 2871, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3136.7088607595, sellCostBuyPrice =sellCostBuyPrice+2871
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2871, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2871
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2871, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2871
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2871
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2871
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2871
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '141', userid = '2', storedetaildate = '2026-10-22 18:03:18' WHERE storedetailid = '2906';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1889', '1', '9', '1', '1364', 'اضافة فاتورة مبيعات', 'sellbillController.php', '150', '141', '2', '2026-10-22 18:03:18','0','0'); -- id=17071
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8767821',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8750121','17700', '0', '2', 'اضافة فاتورة مبيعات', '1364', '8767821', '2026-10-22 18:03:18', '2',  'sellbillController.php','1','','0'); -- id=1674
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17775', '17775', '2026-10-22', '2', '0', '0', '2026-10-22 18:03:18','اضافة فاتورة مبيعات رقم 1364','1','0',null,'0','1364','sellbillController.php?do=showDetail&sellbillid=1364'); -- id=4663
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4663', '419', '17700', '','0'); -- id=4794
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8767820.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4663', '398', '75', '','0'); -- id=4795
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '512431.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4663', '143', '17775', '','0'); -- id=4665
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15411640', 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 ( '16637', '16637', '2026-10-22', '2', '0', '0', '2026-10-22 18:03:18','اضافة فاتورة مبيعات رقم 1364 - صرف البضاعة من المخزن','1','0',null,'0','1364','sellbillController.php?do=showDetail&sellbillid=1364'); -- id=4664
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4664', '402', '16637', '','0'); -- id=4796
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14257466.96', 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 ('4664', '382', '16637', '','0'); -- id=4666
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27403480.24', 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='4663,0,4664' where sellbillid=1364;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 17700, 16637, 16637
                    , 16637, 16637, 16637, 16637
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16637, 16637, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17700, sellCostBuyPrice =sellCostBuyPrice+16637
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16637, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16637
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16637, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16637
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16637
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16637
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16637
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 17700, 16637, 16637
                    , 16637, 16637, 16637, 16637
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,16637, 16637, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17700, sellCostBuyPrice =sellCostBuyPrice+16637
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+16637, sellCostMeanBuyPrice = sellCostMeanBuyPrice+16637
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16637, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16637
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16637
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+16637
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+16637
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 17700, 16637, 16637
                    , 16637, 16637, 16637, 16637, 16637, 16637)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17700, netSellCostBuyPrice = netSellCostBuyPrice+16637
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+16637
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+16637
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+16637
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+16637
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+16637
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+16637
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+16637;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada22eca3986 and sellbillId = 1364 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:33:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:03:19", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:03:19', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18907
UPDATE user SET loginip = "" WHERE userid = 7;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:35:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:05:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:05:27', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18908

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada21da3bc35
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada21da3bc35 and sellbillId = 1365 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:35:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:05:27", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:05:27', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18909
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:38:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:08:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:08:53', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18910
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('شرالو الو بيتر نادر','','217','365','380','0','0','2026-10-22','0','7','0','','0','0','0','0','0','365','365','365','365','365','0','4.11','0','0','.','0','0','0','365','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','365','365','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','365','0','0','0','0','0','0','','','0','0','0','0'); -- id=2461
UPDATE product SET productName = 'شرالو الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365', productSellAllPrice = '380', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365',lastbuyprice_withDiscount = '365',meanbuyprice = '365',meanbuyprice_withDiscount = '365' , productbuypricereal = '365' , buypricereal_precentage = '0' , buytotal_precentage = '4.11' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='365',meanbuyprice_withTax='365',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='365',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
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', '2461', '1.00', '2026-10-22', '7', '0','0246101','380','0','0','365','','0','0','0','0','0','0','0','0','0','0'); -- id=2461
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2461', '1', '0', '7', '2026-10-22'); -- id=3856
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2461', '1', '0', '0', '2461', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17074
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2461, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2461, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3683
UPDATE product SET productName = 'شرالو الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365',lastbuyprice_withDiscount = '365',meanbuyprice = '365',meanbuyprice_withDiscount = '365' , productbuypricereal = '365' , buypricereal_precentage = '0' , buytotal_precentage = '4.11' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='365',meanbuyprice_withTax='365',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='365',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
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 ('موديلات 400 بيتر نادر','','217','385','400','0','0','2026-10-22','0','7','0','','0','0','0','0','0','385','385','385','385','385','0','3.9','0','0','.','0','0','0','385','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','385','385','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','385','0','0','0','0','0','0','','','0','0','0','0'); -- id=2462
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385', productSellAllPrice = '400', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385' , buypricereal_precentage = '0' , buytotal_precentage = '3.9' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
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', '2462', '1.00', '2026-10-22', '7', '0','0246201','400','0','0','385','','0','0','0','0','0','0','0','0','0','0'); -- id=2462
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2462', '1', '400', '7', '2026-10-22'); -- id=3857
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '400', '0', '2462', 'إضافة منتج', 'productController.php', '0', '400', '7', '2026-10-22','0','0'); -- id=17075
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2462, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2462, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3684
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '154000', '154000', '2026-10-22', '7', '0', '0', '2026-10-22 18:08:53','إضافة منتج موديلات 400 بيتر نادر الكمية 400','1','0','-1','0','2462','productController.php?do=edit&id=2462'); -- id=4667
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4667', '382', '154000', '','0'); -- id=4799
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27551220.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4667', '121', '154000', '','0'); -- id=4669
UPDATE accountstree SET name = 'حساب وسيط للارصدة الافتتاحية', customName = 'حساب وسيط للارصدة الافتتاحية', customNameEn = 'Paid Capital', nameEn = 'Paid Capital', parent = '119', accountNature = '1', theValue = '10783304.65', theOrder = '0', layingOrder = '3102', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '4', itemtype2 = '0', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:37' WHERE id = '121';
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385' , buypricereal_precentage = '0' , buytotal_precentage = '3.9' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
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 ('فاشون بيتر نادر','','217','355','370','0','0','2026-10-22','0','7','0','','0','0','0','0','0','355','355','355','355','355','0','4.23','0','0','.','0','0','0','355','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','355','355','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','355','0','0','0','0','0','0','','','0','0','0','0'); -- id=2463
UPDATE product SET productName = 'فاشون بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '355', productSellAllPrice = '370', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02463',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355' , buypricereal_precentage = '0' , buytotal_precentage = '4.23' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2463';
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', '2463', '1.00', '2026-10-22', '7', '0','0246301','370','0','0','355','','0','0','0','0','0','0','0','0','0','0'); -- id=2463
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2463', '1', '0', '7', '2026-10-22'); -- id=3858
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2463', '1', '0', '0', '2463', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17076
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2463, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2463, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3685
UPDATE product SET productName = 'فاشون بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '355.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02463',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355' , buypricereal_precentage = '0' , buytotal_precentage = '4.23' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2463';
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 ('تطريز بيتر نادر','','217','350','365','0','0','2026-10-22','0','7','0','','0','0','0','0','0','350','350','350','350','350','0','4.29','0','0','.','0','0','0','350','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','350','350','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','350','0','0','0','0','0','0','','','0','0','0','0'); -- id=2464
UPDATE product SET productName = 'تطريز بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '350', productSellAllPrice = '365', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02464',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '4.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2464';
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', '2464', '1.00', '2026-10-22', '7', '0','0246401','365','0','0','350','','0','0','0','0','0','0','0','0','0','0'); -- id=2464
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2464', '1', '0', '7', '2026-10-22'); -- id=3859
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2464', '1', '0', '0', '2464', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17077
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2464, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2464, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3686
UPDATE product SET productName = 'تطريز بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '350.00', productSellAllPrice = '365.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02464',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350' , buypricereal_precentage = '0' , buytotal_precentage = '4.29' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2464';
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 ('موديلات 470 بيتر نادر','','217','455','470','0','0','2026-10-22','0','7','0','','0','0','0','0','0','455','455','455','455','455','0','3.3','0','0','.','0','0','0','455','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','455','455','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','455','0','0','0','0','0','0','','','0','0','0','0'); -- id=2465
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455', productSellAllPrice = '470', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455' , buypricereal_precentage = '0' , buytotal_precentage = '3.3' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
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', '2465', '1.00', '2026-10-22', '7', '0','0246501','470','0','0','455','','0','0','0','0','0','0','0','0','0','0'); -- id=2465
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2465', '1', '0', '7', '2026-10-22'); -- id=3860
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '0', '0', '2465', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17078
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2465, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2465, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3687
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455' , buypricereal_precentage = '0' , buytotal_precentage = '3.3' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
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 ('طوكيو بيتر نادر','','217','410','425','0','0','2026-10-22','0','7','0','','0','0','0','0','0','410','410','410','410','410','0','3.66','0','0','.','0','0','0','410','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','410','410','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','410','0','0','0','0','0','0','','','0','0','0','0'); -- id=2466
UPDATE product SET productName = 'طوكيو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '410', productSellAllPrice = '425', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02466',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '3.66' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2466';
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', '2466', '1.00', '2026-10-22', '7', '0','0246601','425','0','0','410','','0','0','0','0','0','0','0','0','0','0'); -- id=2466
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2466', '1', '0', '7', '2026-10-22'); -- id=3861
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2466', '1', '0', '0', '2466', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17079
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2466, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2466, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3688
UPDATE product SET productName = 'طوكيو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '410.00', productSellAllPrice = '425.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02466',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '3.66' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2466';
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 ('موديلات 385 بيتر نادر','','217','370','385','0','0','2026-10-22','0','7','0','','0','0','0','0','0','370','370','370','370','370','0','4.05','0','0','.','0','0','0','370','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','370','370','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','370','0','0','0','0','0','0','','','0','0','0','0'); -- id=2467
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370', productSellAllPrice = '385', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '4.05' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
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', '2467', '1.00', '2026-10-22', '7', '0','0246701','385','0','0','370','','0','0','0','0','0','0','0','0','0','0'); -- id=2467
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2467', '1', '0', '7', '2026-10-22'); -- id=3862
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '0', '0', '2467', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17080
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2467, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2467, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3689
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370' , buypricereal_precentage = '0' , buytotal_precentage = '4.05' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
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 ('توجي دريبات بيتر نادر','','217','495','510','0','0','2026-10-22','0','7','0','','0','0','0','0','0','495','495','495','495','495','0','3.03','0','0','.','0','0','0','495','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','495','495','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','495','0','0','0','0','0','0','','','0','0','0','0'); -- id=2468
UPDATE product SET productName = 'توجي دريبات بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '495', productSellAllPrice = '510', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '14072',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495',lastbuyprice_withDiscount = '495',meanbuyprice = '495',meanbuyprice_withDiscount = '495' , productbuypricereal = '495' , buypricereal_precentage = '0' , buytotal_precentage = '3.03' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='495',meanbuyprice_withTax='495',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2468';
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', '2468', '1.00', '2026-10-22', '7', '0','0246801','510','0','0','495','','0','0','0','0','0','0','0','0','0','0'); -- id=2468
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2468', '1', '0', '7', '2026-10-22'); -- id=3863
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2468', '1', '0', '0', '2468', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17081
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2468, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2468, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3690
UPDATE product SET productName = 'توجي دريبات بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '495.00', productSellAllPrice = '510.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '14072',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495',lastbuyprice_withDiscount = '495',meanbuyprice = '495',meanbuyprice_withDiscount = '495' , productbuypricereal = '495' , buypricereal_precentage = '0' , buytotal_precentage = '3.03' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='495',meanbuyprice_withTax='495',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2468';
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 ('نيو سكاي بيتر نادر','','217','380','395','0','0','2026-10-22','0','7','0','','0','0','0','0','0','380','380','380','380','380','0','3.95','0','0','.','0','0','0','380','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','380','380','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','380','0','0','0','0','0','0','','','0','0','0','0'); -- id=2469
UPDATE product SET productName = 'نيو سكاي بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '380', productSellAllPrice = '395', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02469',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380' , buypricereal_precentage = '0' , buytotal_precentage = '3.95' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2469';
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', '2469', '1.00', '2026-10-22', '7', '0','0246901','395','0','0','380','','0','0','0','0','0','0','0','0','0','0'); -- id=2469
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2469', '1', '0', '7', '2026-10-22'); -- id=3864
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2469', '1', '0', '0', '2469', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17082
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2469, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2469, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3691
UPDATE product SET productName = 'نيو سكاي بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '380.00', productSellAllPrice = '395.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02469',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380' , buypricereal_precentage = '0' , buytotal_precentage = '3.95' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2469';
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 ('فريلد 1127 بيتر نادر','','217','440','455','0','0','2026-10-22','0','7','0','','0','0','0','0','0','440','440','440','440','440','0','3.41','0','0','.','0','0','0','440','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','440','440','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','440','0','0','0','0','0','0','','','0','0','0','0'); -- id=2470
UPDATE product SET productName = 'فريلد 1127 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '440', productSellAllPrice = '455', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02470',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '3.41' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2470';
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', '2470', '1.00', '2026-10-22', '7', '0','0247001','455','0','0','440','','0','0','0','0','0','0','0','0','0','0'); -- id=2470
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2470', '1', '0', '7', '2026-10-22'); -- id=3865
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2470', '1', '0', '0', '2470', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17083
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2470, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2470, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3692
UPDATE product SET productName = 'فريلد 1127 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '440.00', productSellAllPrice = '455.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02470',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '3.41' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2470';
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 ('باجي جيب 1128 بيتر نادر','','217','400','415','0','0','2026-10-22','0','7','0','','0','0','0','0','0','400','400','400','400','400','0','3.75','0','0','.','0','0','0','400','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','400','400','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','400','0','0','0','0','0','0','','','0','0','0','0'); -- id=2471
UPDATE product SET productName = 'باجي جيب 1128 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '400', productSellAllPrice = '415', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02471',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '3.75' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2471';
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', '2471', '1.00', '2026-10-22', '7', '0','0247101','415','0','0','400','','0','0','0','0','0','0','0','0','0','0'); -- id=2471
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2471', '1', '0', '7', '2026-10-22'); -- id=3866
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2471', '1', '0', '0', '2471', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17084
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2471, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2471, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3693
UPDATE product SET productName = 'باجي جيب 1128 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '400.00', productSellAllPrice = '415.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02471',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '3.75' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2471';
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 ('بالون قصات 1130 بيتر هاني','','217','445','460','0','0','2026-10-22','0','7','0','','0','0','0','0','0','445','445','445','445','445','0','3.37','0','0','.','0','0','0','445','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','445','445','0','0','0','0','0','0','0','1','0','0','0','0','0','0','','445','0','0','0','0','0','0','','','0','0','0','0'); -- id=2472
UPDATE product SET productName = 'بالون قصات 1130 بيتر هاني', productDescription = '', productCatId = '217', productBuyPrice = '445', productSellAllPrice = '460', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '04456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '3.37' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2472';
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', '2472', '1.00', '2026-10-22', '7', '0','0247201','460','0','0','445','','0','0','0','0','0','0','0','0','0','0'); -- id=2472
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2472', '1', '0', '7', '2026-10-22'); -- id=3867
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2472', '1', '0', '0', '2472', 'إضافة منتج', 'productController.php', '0', '0', '7', '2026-10-22','0','0'); -- id=17085
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2472, 1,'2026-10-22 18:08:53',7)
                ON DUPLICATE KEY UPDATE productid = 2472, edited = 1, sysdate = '2026-10-22 18:08:53', userid = 7; -- id=3694
UPDATE product SET productName = 'بالون قصات 1130 بيتر هاني', productDescription = '', productCatId = '217', productBuyPrice = '445.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '04456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '3.37' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2472';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:38:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:08:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:08:55', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18911
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:38:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:08:56", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:08:56', '7', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18912
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:40:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:10:42", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:10:42', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18913
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:40:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:10:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:10:47', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18914
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:40:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:10:53", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:10:53', '7', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18915
UPDATE product SET productName = 'شروال الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365.00',lastbuyprice_withDiscount = '365',meanbuyprice = '365.00',meanbuyprice_withDiscount = '365' , productbuypricereal = '365.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',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='365',meanbuyprice_withTax='365',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='365',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2461, 1,'2026-10-22 18:11:02',7)
                ON DUPLICATE KEY UPDATE productid = 2461, edited = 1, sysdate = '2026-10-22 18:11:02', userid = 7; -- id=3683
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385.00',lastbuyprice_withDiscount = '385',meanbuyprice = '385.00',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2462, 1,'2026-10-22 18:11:02',7)
                ON DUPLICATE KEY UPDATE productid = 2462, edited = 1, sysdate = '2026-10-22 18:11:02', userid = 7; -- id=3684
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:42:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:12:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:12:13', '3', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18916

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada25496d722
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada25496d722 and sellbillId = 1366 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:42:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:12:13", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:12:13', '3', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18917
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:46:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:16:03", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:16:03', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18918

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada263792cab
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada263792cab and sellbillId = 1367 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:46:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:16:03", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:16:03', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18919
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:48:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:18:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:18:11', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18920

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada25b7159c7
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 18:18:11', '06ada25b7159c7', '1', '0.00', '0', '25', '1', '4325.00', '4300', '4300', '0', '1', '2026-10-22 18:18:11', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '10' ,'0','','','','','-1','0','0','0','0','0','4300','0','','0','0','4300','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1368
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1368', '0', '2026-10-22 18:18:11', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 18:18:11','0','0','',''); -- id=1604
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6085;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02053', '1368', '19', '2053', '5', '450', '2250', '0', '', '0', '2026-10-22 18:18:11', '2053', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6085-5,','1','1','0','0','450','2250','0','','0','0.00','0','0','0','0'); -- id=5428
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5428;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2053, '2026-10-22', 2236.9942196532, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2236.9942196532, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2236.9942196532, 2150, 2150
                    , 2150, 2150, 2150, 2150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2150, 2150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2236.9942196532, sellCostBuyPrice =sellCostBuyPrice+2150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '20', userid = '2', storedetaildate = '2026-10-22 18:18:11' WHERE storedetailid = '3412';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2053', '1', '5', '1', '1368', 'اضافة فاتورة مبيعات', 'sellbillController.php', '25', '20', '2', '2026-10-22 18:18:11','0','0'); -- id=17088
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6969;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('400','02352', '1368', '27', '2352', '5', '415', '2075', '0', '', '0', '2026-10-22 18:18:11', '2352', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6969-5,','1','1','0','0','415','2075','0','','0','0.00','0','0','0','0'); -- id=5429
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 400
                where sellbilldetailid = 5429;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2352, '2026-10-22', 2063.0057803468, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5, 0, 2000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2063.0057803468, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2063.0057803468, 2000, 2000
                    , 2000, 2000, 2000, 2000
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2000, 1000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2063.0057803468, sellCostBuyPrice =sellCostBuyPrice+2000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2000, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2000
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2000
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '2', storedetaildate = '2026-10-22 18:18:11' WHERE storedetailid = '3746';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2352', '1', '5', '1', '1368', 'اضافة فاتورة مبيعات', 'sellbillController.php', '75', '70', '2', '2026-10-22 18:18:11','0','0'); -- id=17089
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8773221',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8768921','4300', '0', '2', 'اضافة فاتورة مبيعات', '1368', '8773221', '2026-10-22 18:18:11', '2',  'sellbillController.php','1','','0'); -- id=1678
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4325', '4325', '2026-10-22', '2', '0', '0', '2026-10-22 18:18:11','اضافة فاتورة مبيعات رقم 1368','1','0',null,'0','1368','sellbillController.php?do=showDetail&sellbillid=1368'); -- id=4672
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4672', '419', '4300', '','0'); -- id=4804
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8773220.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4672', '398', '25', '','0'); -- id=4805
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '512456.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4672', '143', '4325', '','0'); -- id=4674
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15427090', 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 ( '4150', '4150', '2026-10-22', '2', '0', '0', '2026-10-22 18:18:11','اضافة فاتورة مبيعات رقم 1368 - صرف البضاعة من المخزن','1','0',null,'0','1368','sellbillController.php?do=showDetail&sellbillid=1368'); -- id=4673
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4673', '402', '4150', '','0'); -- id=4806
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14271616.96', 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 ('4673', '382', '4150', '','0'); -- id=4675
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27543330.24', 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='4672,0,4673' where sellbillid=1368;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 4300, 4150, 4150
                    , 4150, 4150, 4150, 4150
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4300, sellCostBuyPrice =sellCostBuyPrice+4150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4300, 4150, 4150
                    , 4150, 4150, 4150, 4150
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,4150, 3150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4300, sellCostBuyPrice =sellCostBuyPrice+4150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 4300, 4150, 4150
                    , 4150, 4150, 4150, 4150, 4150, 3150)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4300, netSellCostBuyPrice = netSellCostBuyPrice+4150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+4150
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+4150
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+4150
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+4150
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+4150
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+4150
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3150;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada25b7159c7 and sellbillId = 1368 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:48:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:18:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:18:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18921
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:49:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:19:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:19:14', '7', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18922
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 ('06ada27086d338', '2026-10-22 18:08:56', '12', '60100.00', '310275', '0', '0', '250175.00',  '250175.00', '0', '250175', '1', '2026-10-22 18:19:14', '', '7', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=354
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 ('02461', '354', '217', '2461', '30', '365', '10950.00', '0', '', '2026-10-22 18:19:14', '2461','','','0','0','0','0','0',null,'365','10950','0','0','0','0','0','0','0','0','1'); -- id=1843
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2461, 0, 0
                    , 365, 30, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 365,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7175
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2461', '365', '30', '0', 'buyBillController.php', '1843', '', '0', '0'); -- id=1383
UPDATE product SET  productBuyPrice = "365" WHERE productId = 2461 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1843 ;
UPDATE product SET productName = 'شروال الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365',lastbuyprice_withDiscount = '365',meanbuyprice = '365',meanbuyprice_withDiscount = '365' , productbuypricereal = '365.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',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='365',meanbuyprice_withTax='365',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='365',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
UPDATE buybilldetail SET  lastbuyprice = 365 , meanbuyprice = 365, lastbuyprice_withDiscount = 365, meanbuyprice_withDiscount = 365
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 365, lastbuyprice_withDiscountAndTax = 365
                where buybilldetailid = 1843;
UPDATE productunit SET proUnitBuyPrice  = 365 * productnumber WHERE productid = 2461;
UPDATE storedetail SET  productquantity = '30', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3856';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2461', '1', '30', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '7', '2026-10-22 18:08:56','0','0'); -- id=17090
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 ('02462', '354', '217', '2462', '30', '385', '11550.00', '0', '', '2026-10-22 18:19:14', '2462','','','0','0','0','0','0',null,'385','11550','0','0','0','0','0','0','0','0','1'); -- id=1844
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 30, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 385,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7176
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2462', '385', '30', '0', 'buyBillController.php', '1844', '', '0', '0'); -- id=1384
UPDATE product SET  productBuyPrice = "385" WHERE productId = 2462 ;
UPDATE buybilldetail SET  quantitybefore = 400 WHERE buybilldetailid = 1844 ;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE buybilldetail SET  lastbuyprice = 385 , meanbuyprice = 385, lastbuyprice_withDiscount = 385, meanbuyprice_withDiscount = 385
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where buybilldetailid = 1844;
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '430', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '30', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '400', '430', '7', '2026-10-22 18:08:56','0','0'); -- id=17091
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 ('02463', '354', '217', '2463', '20', '355', '7100.00', '0', '', '2026-10-22 18:19:14', '2463','','','0','0','0','0','0',null,'355','7100','0','0','0','0','0','0','0','0','1'); -- id=1845
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2463, 0, 0
                    , 355, 20, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 355,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7177
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2463', '355', '20', '0', 'buyBillController.php', '1845', '', '0', '0'); -- id=1385
UPDATE product SET  productBuyPrice = "355" WHERE productId = 2463 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1845 ;
UPDATE product SET productName = 'فاشون بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '355.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02463',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.23' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='355',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2463';
UPDATE buybilldetail SET  lastbuyprice = 355 , meanbuyprice = 355, lastbuyprice_withDiscount = 355, meanbuyprice_withDiscount = 355
        , lastbuyprice_withTax = 355, meanbuyprice_withTax = 355, lastbuyprice_withDiscountAndTax = 355
                where buybilldetailid = 1845;
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2463;
UPDATE storedetail SET  productquantity = '20', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3858';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2463', '1', '20', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '7', '2026-10-22 18:08:56','0','0'); -- id=17092
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 ('02464', '354', '217', '2464', '50', '350', '17500.00', '0', '', '2026-10-22 18:19:14', '2464','','','0','0','0','0','0',null,'350','17500','0','0','0','0','0','0','0','0','1'); -- id=1846
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2464, 0, 0
                    , 350, 50, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7178
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2464', '350', '50', '0', 'buyBillController.php', '1846', '', '0', '0'); -- id=1386
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2464 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1846 ;
UPDATE product SET productName = 'تطريز بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '350.00', productSellAllPrice = '365.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02464',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.29' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2464';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1846;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2464;
UPDATE storedetail SET  productquantity = '50', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3859';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2464', '1', '50', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '50', '7', '2026-10-22 18:08:56','0','0'); -- id=17093
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 ('02462', '354', '217', '2462', '15', '385', '5775.00', '0', '', '2026-10-22 18:19:14', '2462','','','0','0','0','0','0',null,'385','5775','0','0','0','0','0','0','0','0','1'); -- id=1847
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 15, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 385,
                        buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7176
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2462', '385', '15', '0', 'buyBillController.php', '1847', '', '0', '0'); -- id=1387
UPDATE product SET  productBuyPrice = "385" WHERE productId = 2462 ;
UPDATE buybilldetail SET  quantitybefore = 430 WHERE buybilldetailid = 1847 ;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE buybilldetail SET  lastbuyprice = 385 , meanbuyprice = 385, lastbuyprice_withDiscount = 385, meanbuyprice_withDiscount = 385
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where buybilldetailid = 1847;
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '445', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '15', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '430', '445', '7', '2026-10-22 18:08:56','0','0'); -- id=17094
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 ('02465', '354', '217', '2465', '45', '455', '20475.00', '0', '', '2026-10-22 18:19:14', '2465','','','0','0','0','0','0',null,'455','20475','0','0','0','0','0','0','0','0','1'); -- id=1848
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 455,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7180
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2465', '455', '45', '0', 'buyBillController.php', '1848', '', '0', '0'); -- id=1388
UPDATE product SET  productBuyPrice = "455" WHERE productId = 2465 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1848 ;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE buybilldetail SET  lastbuyprice = 455 , meanbuyprice = 455, lastbuyprice_withDiscount = 455, meanbuyprice_withDiscount = 455
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 455
                where buybilldetailid = 1848;
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17095
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 ('02465', '354', '217', '2465', '45', '455', '20475.00', '0', '', '2026-10-22 18:19:14', '2465','','','0','0','0','0','0',null,'455','20475','0','0','0','0','0','0','0','0','1'); -- id=1849
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 455,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7180
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2465', '455', '45', '0', 'buyBillController.php', '1849', '', '0', '0'); -- id=1389
UPDATE product SET  productBuyPrice = "455" WHERE productId = 2465 ;
UPDATE buybilldetail SET  quantitybefore = 45 WHERE buybilldetailid = 1849 ;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE buybilldetail SET  lastbuyprice = 455 , meanbuyprice = 455, lastbuyprice_withDiscount = 455, meanbuyprice_withDiscount = 455
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 455
                where buybilldetailid = 1849;
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '90', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '45', '90', '7', '2026-10-22 18:08:56','0','0'); -- id=17096
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 ('02466', '354', '217', '2466', '45', '410', '18450.00', '0', '', '2026-10-22 18:19:14', '2466','','','0','0','0','0','0',null,'410','18450','0','0','0','0','0','0','0','0','1'); -- id=1850
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2466, 0, 0
                    , 410, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 410,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7182
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2466', '410', '45', '0', 'buyBillController.php', '1850', '', '0', '0'); -- id=1390
UPDATE product SET  productBuyPrice = "410" WHERE productId = 2466 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1850 ;
UPDATE product SET productName = 'طوكيو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '410.00', productSellAllPrice = '425.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02466',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.66' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='410',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2466';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 410, meanbuyprice_withDiscount = 410
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 410, lastbuyprice_withDiscountAndTax = 410
                where buybilldetailid = 1850;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 2466;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3861';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2466', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17097
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 ('02467', '354', '217', '2467', '60', '370', '22200.00', '0', '', '2026-10-22 18:19:14', '2467','','','0','0','0','0','0',null,'370','22200','0','0','0','0','0','0','0','0','1'); -- id=1851
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 60, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7183
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2467', '370', '60', '0', 'buyBillController.php', '1851', '', '0', '0'); -- id=1391
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2467 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1851 ;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1851;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '60', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '60', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '7', '2026-10-22 18:08:56','0','0'); -- id=17098
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 ('14072', '354', '217', '2468', '45', '495', '22275.00', '0', '', '2026-10-22 18:19:14', '2468','','','0','0','0','0','0',null,'495','22275','0','0','0','0','0','0','0','0','1'); -- id=1852
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2468, 0, 0
                    , 495, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7184
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2468', '495', '45', '0', 'buyBillController.php', '1852', '', '0', '0'); -- id=1392
UPDATE product SET  productBuyPrice = "495" WHERE productId = 2468 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1852 ;
UPDATE product SET productName = 'توجي دريبات بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '495.00', productSellAllPrice = '510.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '14072',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495',lastbuyprice_withDiscount = '495',meanbuyprice = '495',meanbuyprice_withDiscount = '495' , productbuypricereal = '495.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.03' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',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='495',meanbuyprice_withTax='495',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2468';
UPDATE buybilldetail SET  lastbuyprice = 495 , meanbuyprice = 495, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 495, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 1852;
UPDATE productunit SET proUnitBuyPrice  = 495 * productnumber WHERE productid = 2468;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3863';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2468', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17099
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 ('02469', '354', '217', '2469', '45', '380', '17100.00', '0', '', '2026-10-22 18:19:14', '2469','','','0','0','0','0','0',null,'380','17100','0','0','0','0','0','0','0','0','1'); -- id=1853
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2469, 0, 0
                    , 380, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 380,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7185
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2469', '380', '45', '0', 'buyBillController.php', '1853', '', '0', '0'); -- id=1393
UPDATE product SET  productBuyPrice = "380" WHERE productId = 2469 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1853 ;
UPDATE product SET productName = 'نيو سكاي بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '380.00', productSellAllPrice = '395.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02469',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.95' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',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='380',meanbuyprice_withTax='380',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2469';
UPDATE buybilldetail SET  lastbuyprice = 380 , meanbuyprice = 380, lastbuyprice_withDiscount = 380, meanbuyprice_withDiscount = 380
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 380, lastbuyprice_withDiscountAndTax = 380
                where buybilldetailid = 1853;
UPDATE productunit SET proUnitBuyPrice  = 380 * productnumber WHERE productid = 2469;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3864';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2469', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17100
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 ('02470', '354', '217', '2470', '45', '440', '19800.00', '0', '', '2026-10-22 18:19:14', '2470','','','0','0','0','0','0',null,'440','19800','0','0','0','0','0','0','0','0','1'); -- id=1854
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2470, 0, 0
                    , 440, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7186
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2470', '440', '45', '0', 'buyBillController.php', '1854', '', '0', '0'); -- id=1394
UPDATE product SET  productBuyPrice = "440" WHERE productId = 2470 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1854 ;
UPDATE product SET productName = 'فريلد 1127 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '440.00', productSellAllPrice = '455.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02470',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.41' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='440',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2470';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1854;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2470;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3865';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2470', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17101
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 ('02467', '354', '217', '2467', '50', '370', '18500.00', '0', '', '2026-10-22 18:19:14', '2467','','','0','0','0','0','0',null,'370','18500','0','0','0','0','0','0','0','0','1'); -- id=1855
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 50, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7183
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2467', '370', '50', '0', 'buyBillController.php', '1855', '', '0', '0'); -- id=1395
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2467 ;
UPDATE buybilldetail SET  quantitybefore = 60 WHERE buybilldetailid = 1855 ;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1855;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '110', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '50', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '60', '110', '7', '2026-10-22 18:08:56','0','0'); -- id=17102
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 ('02471', '354', '217', '2471', '45', '400', '18000.00', '0', '', '2026-10-22 18:19:14', '2471','','','0','0','0','0','0',null,'400','18000','0','0','0','0','0','0','0','0','1'); -- id=1856
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2471, 0, 0
                    , 400, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 400,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7188
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2471', '400', '45', '0', 'buyBillController.php', '1856', '', '0', '0'); -- id=1396
UPDATE product SET  productBuyPrice = "400" WHERE productId = 2471 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1856 ;
UPDATE product SET productName = 'باجي جيب 1128 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '400.00', productSellAllPrice = '415.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02471',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.75' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='400',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2471';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 400, meanbuyprice_withDiscount = 400
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 400
                where buybilldetailid = 1856;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 2471;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3866';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2471', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17103
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 ('04456', '354', '217', '2472', '45', '445', '20025.00', '0', '', '2026-10-22 18:19:14', '2472','','','0','0','0','0','0',null,'445','20025','0','0','0','0','0','0','0','0','1'); -- id=1857
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2472, 0, 0
                    , 445, 45, 0, 0, 7, '2026-10-22 18:19:14')
                ON DUPLICATE KEY UPDATE buyprice = 445,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 7,sysDate = '2026-10-22 18:19:14' ; -- id=7189
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2472', '445', '45', '0', 'buyBillController.php', '1857', '', '0', '0'); -- id=1397
UPDATE product SET  productBuyPrice = "445" WHERE productId = 2472 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1857 ;
UPDATE product SET productName = 'بالون قصات 1130 بيتر هاني', productDescription = '', productCatId = '217', productBuyPrice = '445.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '04456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.37' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='445',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2472';
UPDATE buybilldetail SET  lastbuyprice = 445 , meanbuyprice = 445, lastbuyprice_withDiscount = 445, meanbuyprice_withDiscount = 445
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 445
                where buybilldetailid = 1857;
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 2472;
UPDATE storedetail SET  productquantity = '45', userid = '7', storedetaildate = '2026-10-22' WHERE storedetailid = '3867';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2472', '1', '45', '0', '354', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '7', '2026-10-22 18:08:56','0','0'); -- id=17104
UPDATE supplier SET  suppliercurrentDebt = '310275',suppliercurrentDebtInCurrency= '310275' , userid = '7', supplierdate = '2026-10-22 18:19:14'   WHERE supplierid = '12';
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 ('12', '60100.00', '250175', '0', 'اضافة فاتورة مشتريات', '354', '310275', '2026-10-22 18:08:56', '7', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','250175','1','60100','250175','310275','0',''); -- id=907
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '250175', '250175', '2026-10-22', '7', '0', '0', '2026-10-22 18:19:14','اضافة فاتورة مشتريات رقم 354','1','0',null,'0','354','buyBillController.php?do=details&id=354'); -- id=4674
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4674', '382', '250175', '','0'); -- id=4807
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27793505.24', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4674', '431', '250175', '','0'); -- id=4676
UPDATE accountstree SET name = 'بيتر نادر JP - مورد', customName = 'بيتر نادر JP - مورد', customNameEn = 'بيتر نادر JP - مورد', nameEn = 'بيتر نادر JP - مورد', parent = '81', accountNature = '1', theValue = '220175', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '431';
update buybill set dailyentryid='4674,0' where buybillid=354;
COMMIT;
UPDATE product SET overAllAveragePrice = 365 WHERE productId = 2461;UPDATE product SET overAllAveragePrice = 385 WHERE productId = 2462;UPDATE product SET overAllAveragePrice = 355 WHERE productId = 2463;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2464;UPDATE product SET overAllAveragePrice = 455 WHERE productId = 2465;UPDATE product SET overAllAveragePrice = 410 WHERE productId = 2466;UPDATE product SET overAllAveragePrice = 370 WHERE productId = 2467;UPDATE product SET overAllAveragePrice = 495 WHERE productId = 2468;UPDATE product SET overAllAveragePrice = 380 WHERE productId = 2469;UPDATE product SET overAllAveragePrice = 440 WHERE productId = 2470;UPDATE product SET overAllAveragePrice = 400 WHERE productId = 2471;UPDATE product SET overAllAveragePrice = 445 WHERE productId = 2472;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:49:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:19:14", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:19:14', '7', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=354'); -- id=18923
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:49:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:19:21", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:19:21', '7', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=354&type=2'); -- id=18924
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:57:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:27:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 18:27:23', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18925
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:57:23";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 18:27:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 18:27:23', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18926
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:57:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:27:25", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:27:25', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18927
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:57:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:27:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:27:31', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18928

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada2933c6765
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 18:27:31', '06ada2933c6765', '1', '0.00', '0', '0', '1', '17595.00', '17595', '17595', '0', '1', '2026-10-22 18:27:31', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '39' ,'0','','','','','-1','0','0','0','0','0','17595','0','','0','0','17595','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1369
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1369', '0', '2026-10-22 18:27:31', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '17595', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 18:27:31','0','0','',''); -- id=1605
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7080;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437.1','02409', '1369', '210', '2409', '3', '470', '1410', '0', '', '0', '2026-10-22 18:27:31', '2409', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7080-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5430
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 437.10, meanbuyprice_withDiscount = 437.10
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where sellbilldetailid = 5430;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2409, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '159', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '162', '159', '2', '2026-10-22 18:27:31','0','0'); -- id=17105
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7077;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('413.85','02406', '1369', '210', '2406', '3', '445', '1335', '0', '', '0', '2026-10-22 18:27:31', '2406', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7077-3,','1','1','0','0','445','1335','0','','0','0.00','0','0','0','0'); -- id=5431
UPDATE sellbilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 413.85, meanbuyprice_withDiscount = 413.85
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 445, lastbuyprice_withDiscountAndTax = 413.85
                where sellbilldetailid = 5431;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2406, '2026-10-22', 1335, 1335, 1335
                    , 1335, 1241.55, 1241.55, 1241.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1335, 1335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1335, sellCostBuyPrice =sellCostBuyPrice+1335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1241.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1241.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1241.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1335, 1335, 1335
                    , 1335, 1241.55, 1241.55, 1241.55
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1335, 1335, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1335, sellCostBuyPrice =sellCostBuyPrice+1335
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1335, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1335
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1241.55, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1241.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1241.55
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1335
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1335
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3801';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2406', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '60', '57', '2', '2026-10-22 18:27:31','0','0'); -- id=17106
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7082;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('483.6','02410', '1369', '210', '2410', '3', '520', '1560', '0', '', '0', '2026-10-22 18:27:31', '2410', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7082-3,','1','1','0','0','520','1560','0','','0','0.00','0','0','0','0'); -- id=5432
UPDATE sellbilldetail SET  lastbuyprice = 520.00 , meanbuyprice = 520.00, lastbuyprice_withDiscount = 483.60, meanbuyprice_withDiscount = 483.60
        , lastbuyprice_withTax = 520, meanbuyprice_withTax = 520, lastbuyprice_withDiscountAndTax = 483.6
                where sellbilldetailid = 5432;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2410, '2026-10-22', 1560, 1560, 1560
                    , 1560, 1450.8, 1450.8, 1450.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1450.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1450.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1450.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1560, 1560, 1560
                    , 1560, 1450.8, 1450.8, 1450.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1560, 1560, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1560
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1560, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1560
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1450.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1450.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1450.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1560
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1560
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '75', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3805';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2410', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '78', '75', '2', '2026-10-22 18:27:31','0','0'); -- id=17107
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7079;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','02408', '1369', '210', '2408', '3', '450', '1350', '0', '', '0', '2026-10-22 18:27:31', '2408', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7079-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5433
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 5433;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2408, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1255.5, 1255.5, 1255.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1255.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1255.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1255.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1350, 1350
                    , 1350, 1255.5, 1255.5, 1255.5
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1255.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1255.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1255.5
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '129', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2408', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '132', '129', '2', '2026-10-22 18:27:31','0','0'); -- id=17108
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1369', '166', '2028', '6', '320', '1920', '0', '', '0', '2026-10-22 18:27:31', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-6,','1','1','0','0','320','1920','0','','0','0.00','0','0','0','0'); -- id=5434
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5434;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 1920, 1920, 1920
                    , 1920, 1785.6, 1785.6, 1781.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1781.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1920, 1920, 1920
                    , 1920, 1785.6, 1785.6, 1781.76
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1920, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1785.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1785.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1781.76
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '66', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '6', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '66', '2', '2026-10-22 18:27:31','0','0'); -- id=17109
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7083;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('465','02411', '1369', '210', '2411', '9', '500', '4500', '0', '', '0', '2026-10-22 18:27:31', '2411', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7083-9,','1','1','0','0','500','4500','0','','0','0.00','0','0','0','0'); -- id=5435
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 465.00, meanbuyprice_withDiscount = 465.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 465
                where sellbilldetailid = 5435;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2411, '2026-10-22', 4500, 4500, 4500
                    , 4500, 4185, 4185, 4185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 4500, 4500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4500, sellCostBuyPrice =sellCostBuyPrice+4500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4500, 4500, 4500
                    , 4500, 4185, 4185, 4185
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4500, 4500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4500, sellCostBuyPrice =sellCostBuyPrice+4500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4185
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4185
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3806';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2411', '1', '9', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '63', '2', '2026-10-22 18:27:31','0','0'); -- id=17110
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7079;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('418.5','02408', '1369', '210', '2408', '6', '450', '2700', '0', '', '0', '2026-10-22 18:27:31', '2408', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7079-6,','1','1','0','0','450','2700','0','','0','0.00','0','0','0','0'); -- id=5436
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 418.50, meanbuyprice_withDiscount = 418.50
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 418.5
                where sellbilldetailid = 5436;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2408, '2026-10-22', 2700, 2700, 2700
                    , 2700, 2511, 2511, 2511
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2511, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2511
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2511
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2700, 2700, 2700
                    , 2700, 2511, 2511, 2511
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2700, 2700, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2700, sellCostBuyPrice =sellCostBuyPrice+2700
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2700, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2700
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2511, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2511
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2511
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2700
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2700
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3803';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2408', '1', '6', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '129', '123', '2', '2026-10-22 18:27:31','0','0'); -- id=17111
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7080;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437.1','02409', '1369', '210', '2409', '3', '470', '1410', '0', '', '0', '2026-10-22 18:27:31', '2409', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7080-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5437
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 437.10, meanbuyprice_withDiscount = 437.10
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where sellbilldetailid = 5437;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2409, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '156', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '159', '156', '2', '2026-10-22 18:27:31','0','0'); -- id=17112
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7080;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('437.1','02409', '1369', '210', '2409', '3', '470', '1410', '0', '', '0', '2026-10-22 18:27:31', '2409', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7080-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5438
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 437.10, meanbuyprice_withDiscount = 437.10
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 437.1
                where sellbilldetailid = 5438;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2409, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1410, 1410
                    , 1410, 1311.3, 1311.3, 1311.3
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1410, 1410, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1410
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1410, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1410
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1311.3, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1311.3
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1311.3
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1410
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1410
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '153', userid = '2', storedetaildate = '2026-10-22 18:27:31' WHERE storedetailid = '3804';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2409', '1', '3', '1', '1369', 'اضافة فاتورة مبيعات', 'sellbillController.php', '156', '153', '2', '2026-10-22 18:27:31','0','0'); -- id=17113
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8790816',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8773221','17595', '0', '2', 'اضافة فاتورة مبيعات', '1369', '8790816', '2026-10-22 18:27:31', '2',  'sellbillController.php','1','','0'); -- id=1679
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '17595', '17595', '2026-10-22', '2', '0', '0', '2026-10-22 18:27:31','اضافة فاتورة مبيعات رقم 1369','1','0',null,'0','1369','sellbillController.php?do=showDetail&sellbillid=1369'); -- id=4675
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4675', '419', '17595', '','0'); -- id=4808
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8790815.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4675', '143', '17595', '','0'); -- id=4677
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15444685', 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 ( '16363.35', '16363.35', '2026-10-22', '2', '0', '0', '2026-10-22 18:27:31','اضافة فاتورة مبيعات رقم 1369 - صرف البضاعة من المخزن','1','0',null,'0','1369','sellbillController.php?do=showDetail&sellbillid=1369'); -- id=4676
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4676', '402', '16363.35', '','0'); -- id=4809
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14287980.31', 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 ('4676', '382', '16363.35', '','0'); -- id=4678
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27777141.89', 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='4675,0,4676' where sellbillid=1369;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 17595, 17595, 17595
                    , 17595, 16363.35, 16363.35, 16359.51
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17595, 17595, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17595, sellCostBuyPrice =sellCostBuyPrice+17595
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17595, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17595
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16363.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16363.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16359.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17595
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17595
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 17595, 17595, 17595
                    , 17595, 16363.35, 16363.35, 16359.51
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,17595, 17595, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+17595, sellCostBuyPrice =sellCostBuyPrice+17595
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+17595, sellCostMeanBuyPrice = sellCostMeanBuyPrice+17595
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+16363.35, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+16363.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+16359.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+17595
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+17595
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 17595, 17595, 17595
                    , 17595, 16363.35, 16363.35, 16359.51, 17595, 17595)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+17595, netSellCostBuyPrice = netSellCostBuyPrice+17595
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+17595
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+17595
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+16363.35
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+16363.35
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+16359.51
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+17595
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+17595;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada2933c6765 and sellbillId = 1369 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 14:57:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:27:31", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:27:31', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18929
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:07:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:37:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 18:37:26', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=18930
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:07:26";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 18:37:26", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 18:37:26', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=18931
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:07:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:37:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:37:28', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18932
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:07:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:37:34", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:37:34', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18933

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada2b639302f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 18:37:34', '06ada2b639302f', '1', '0.00', '0', '235', '1', '30485.00', '30250', '30250', '0', '1', '2026-10-22 18:37:34', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '84' ,'0','','','','','-1','0','0','0','0','0','30250','0','','0','0','30250','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1370
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1370', '0', '2026-10-22 18:37:34', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '30250', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 18:37:34','0','0','',''); -- id=1606
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6534;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('200','01975', '1370', '59', '1975', '9', '210', '1890', '0', '', '0', '2026-10-22 18:37:34', '1975', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6534-9,','1','1','0','0','210','1890','0','','0','0.00','0','0','0','0'); -- id=5439
UPDATE sellbilldetail SET  lastbuyprice = 200.00 , meanbuyprice = 200.00, lastbuyprice_withDiscount = 200.00, meanbuyprice_withDiscount = 200.00
        , lastbuyprice_withTax = 200, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 200
                where sellbilldetailid = 5439;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1975, '2026-10-22', 1875.4305396096, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1875.4305396096, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1875.4305396096, 1800, 1800
                    , 1800, 1800, 1800, 1800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1800, 1800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1875.4305396096, sellCostBuyPrice =sellCostBuyPrice+1800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '32', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '2992';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1975', '1', '9', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '41', '32', '2', '2026-10-22 18:37:34','0','0'); -- id=17114
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6536;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01973', '1370', '59', '1973', '6', '340', '2040', '0', '', '0', '2026-10-22 18:37:34', '1973', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6536-6,','1','1','0','0','340','2040','0','','0','0.00','0','0','0','0'); -- id=5440
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 327.74, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 327.74
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 327.74, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 5440;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1973, '2026-10-22', 2024.2742332295, 1980, 1980
                    , 1966.44, 1980, 1966.44, 1959.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1980, 1966.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2024.2742332295, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1966.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1966.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1959.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1966.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2024.2742332295, 1980, 1980
                    , 1966.44, 1980, 1966.44, 1959.54
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1980, 1966.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2024.2742332295, sellCostBuyPrice =sellCostBuyPrice+1980
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1980, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1966.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1980, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1966.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1959.54
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1980
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1966.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '57', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '2990';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1973', '1', '6', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '63', '57', '2', '2026-10-22 18:37:34','0','0'); -- id=17115
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 7099;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','02425', '1370', '190', '2425', '4', '320', '1280', '0', '', '0', '2026-10-22 18:37:34', '2425', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7099-4,','1','1','0','0','320','1280','0','','0','0.00','0','0','0','0'); -- id=5441
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5441;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2425, '2026-10-22', 1270.1328522224, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1270.1328522224, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1270.1328522224, 1200, 1200
                    , 1200, 1200, 1200, 1200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 1200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1270.1328522224, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '8', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '4', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '8', '2', '2026-10-22 18:37:34','0','0'); -- id=17116
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6990;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7171;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('394','02359', '1370', '147', '2359', '15', '425', '6375', '0', '', '0', '2026-10-22 18:37:34', '2359', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6990-6,7171-9,','1','1','0','0','425','6375','0','','0','0.00','0','0','0','0'); -- id=5442
UPDATE sellbilldetail SET  lastbuyprice = 394.00 , meanbuyprice = 394.00, lastbuyprice_withDiscount = 394.00, meanbuyprice_withDiscount = 394.00
        , lastbuyprice_withTax = 394, meanbuyprice_withTax = 394, lastbuyprice_withDiscountAndTax = 394
                where sellbilldetailid = 5442;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2359, '2026-10-22', 6325.8569788421, 5910, 5910
                    , 5910, 5910, 5910, 5910
                    , 0, 0, 0, 0
                    , 0, 0, 0, 15, 0, 5910, 5910, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6325.8569788421, sellCostBuyPrice =sellCostBuyPrice+5910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5910
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5910
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5910
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+15
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6325.8569788421, 5910, 5910
                    , 5910, 5910, 5910, 5910
                    , 0, 0, 0, 0
                    , 0, 0, 0, 5910, 5910, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6325.8569788421, sellCostBuyPrice =sellCostBuyPrice+5910
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+5910, sellCostMeanBuyPrice = sellCostMeanBuyPrice+5910
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5910, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5910
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5910
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+5910
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5910
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3753';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2359', '1', '15', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '78', '63', '2', '2026-10-22 18:37:34','0','0'); -- id=17117
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 981;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('379','01887', '1370', '147', '1887', '12', '410', '4920', '0', '', '0', '2026-10-22 18:37:34', '1887', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','981-12,','1','1','0','0','410','4920','0','','0','0.00','0','0','0','0'); -- id=5443
UPDATE sellbilldetail SET  lastbuyprice = 379.00 , meanbuyprice = 379.00, lastbuyprice_withDiscount = 379.00, meanbuyprice_withDiscount = 379.00
        , lastbuyprice_withTax = 379, meanbuyprice_withTax = 379, lastbuyprice_withDiscountAndTax = 379
                where sellbilldetailid = 5443;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1887, '2026-10-22', 4882.0731507299, 4548, 4548
                    , 4548, 4548, 4548, 4548
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 4548, 4548, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4882.0731507299, sellCostBuyPrice =sellCostBuyPrice+4548
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4548, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4548
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4548, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4548
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4548
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4548
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4548
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4882.0731507299, 4548, 4548
                    , 4548, 4548, 4548, 4548
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4548, 4548, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4882.0731507299, sellCostBuyPrice =sellCostBuyPrice+4548
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4548, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4548
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4548, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4548
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4548
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4548
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4548
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '228', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '2904';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1887', '1', '12', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '240', '228', '2', '2026-10-22 18:37:34','0','0'); -- id=17118
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6641;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('306','02240', '1370', '76', '2240', '6', '340', '2040', '0', '', '0', '2026-10-22 18:37:34', '2240', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6641-6,','1','1','0','0','340','2040','0','','0','0.00','0','0','0','0'); -- id=5444
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 306.00, meanbuyprice_withDiscount = 323.00
        , lastbuyprice_withTax = 340, meanbuyprice_withTax = 170, lastbuyprice_withDiscountAndTax = 306
                where sellbilldetailid = 5444;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2240, '2026-10-22', 2024.2742332295, 2040, 2040
                    , 2040, 1836, 1938, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2040, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2024.2742332295, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1938
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2024.2742332295, 2040, 2040
                    , 2040, 1836, 1938, 1836
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2040, 1020, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2024.2742332295, sellCostBuyPrice =sellCostBuyPrice+2040
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2040, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2040
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1836, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1938
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1836
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2040
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1020
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3631';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2240', '1', '6', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '2', '2026-10-22 18:37:34','0','0'); -- id=17119
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02176', '1370', '190', '2176', '3', '330', '990', '0', '', '0', '2026-10-22 18:37:34', '2176', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6290-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5445
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5445;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2176, '2026-10-22', 982.36837789077, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+982.36837789077, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 982.36837789077, 930, 930
                    , 930, 930, 930, 930
                    , 0, 0, 0, 0
                    , 0, 0, 0, 930, 930, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+982.36837789077, sellCostBuyPrice =sellCostBuyPrice+930
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+930, sellCostMeanBuyPrice = sellCostMeanBuyPrice+930
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+930, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+930
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+930
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+930
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+930
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '53', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '3', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '56', '53', '2', '2026-10-22 18:37:34','0','0'); -- id=17120
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 6913;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('368','01584', '1370', '115', '1584', '9', '400', '3600', '0', '', '0', '2026-10-22 18:37:34', '1584', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6913-9,','1','1','0','0','400','3600','0','','0','0.00','0','0','0','0'); -- id=5446
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 368.00, meanbuyprice_withDiscount = 368.00
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 400, lastbuyprice_withDiscountAndTax = 368
                where sellbilldetailid = 5446;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1584, '2026-10-22', 3572.2486468755, 3600, 3600
                    , 3600, 3312, 3312, 3342.51
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3572.2486468755, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3342.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3572.2486468755, 3600, 3600
                    , 3600, 3312, 3312, 3342.51
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3600, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3572.2486468755, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3600
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3312, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3312
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3342.51
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3600
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '1609';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1584', '1', '9', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '12', '2', '2026-10-22 18:37:34','0','0'); -- id=17121
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 6762;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('395','02277', '1370', '32', '2277', '10', '410', '4100', '0', '', '0', '2026-10-22 18:37:34', '2277', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6762-10,','1','1','0','0','410','4100','0','','0','0.00','0','0','0','0'); -- id=5447
UPDATE sellbilldetail SET  lastbuyprice = 395.00 , meanbuyprice = 395.00, lastbuyprice_withDiscount = 395.00, meanbuyprice_withDiscount = 395.00
        , lastbuyprice_withTax = 395, meanbuyprice_withTax = 395, lastbuyprice_withDiscountAndTax = 395
                where sellbilldetailid = 5447;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2277, '2026-10-22', 4068.3942922749, 3950, 3950
                    , 3950, 3950, 3950, 3950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3950, 3950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4068.3942922749, sellCostBuyPrice =sellCostBuyPrice+3950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4068.3942922749, 3950, 3950
                    , 3950, 3950, 3950, 3950
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3950, 3950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4068.3942922749, sellCostBuyPrice =sellCostBuyPrice+3950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3950, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3950
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3950
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3670';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2277', '1', '10', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '70', '2', '2026-10-22 18:37:34','0','0'); -- id=17122
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+10 where id = 7132;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','02447', '1370', '13', '2447', '10', '325', '3250', '0', '', '0', '2026-10-22 18:37:34', '2447', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','7132-10,','1','1','0','0','325','3250','0','','0','0.00','0','0','0','0'); -- id=5448
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5448;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2447, '2026-10-22', 3224.9466950959, 3100, 3100
                    , 3100, 3100, 3100, 3100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 10, 0, 3100, 3100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3224.9466950959, sellCostBuyPrice =sellCostBuyPrice+3100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+10
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3224.9466950959, 3100, 3100
                    , 3100, 3100, 3100, 3100
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3100, 3100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3224.9466950959, sellCostBuyPrice =sellCostBuyPrice+3100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3100, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3100
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3100
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '70', userid = '2', storedetaildate = '2026-10-22 18:37:34' WHERE storedetailid = '3842';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2447', '1', '10', '1', '1370', 'اضافة فاتورة مبيعات', 'sellbillController.php', '80', '70', '2', '2026-10-22 18:37:34','0','0'); -- id=17123
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8821066',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8790816','30250', '0', '2', 'اضافة فاتورة مبيعات', '1370', '8821066', '2026-10-22 18:37:34', '2',  'sellbillController.php','1','','0'); -- id=1680
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30485', '30485', '2026-10-22', '2', '0', '0', '2026-10-22 18:37:34','اضافة فاتورة مبيعات رقم 1370','1','0',null,'0','1370','sellbillController.php?do=showDetail&sellbillid=1370'); -- id=4677
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4677', '419', '30250', '','0'); -- id=4810
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8821065.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4677', '398', '235', '','0'); -- id=4811
UPDATE accountstree SET name = 'خصم مسموح به', customName = 'خصم مسموح به', customNameEn = '', nameEn = '', parent = '158', accountNature = '0', theValue = '512691.95', theOrder = '0', layingOrder = '51', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-08-08 17:58:26' WHERE id = '398';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4677', '143', '30485', '','0'); -- id=4679
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15475170', 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 ( '28566', '28566', '2026-10-22', '2', '0', '0', '2026-10-22 18:37:34','اضافة فاتورة مبيعات رقم 1370 - صرف البضاعة من المخزن','1','0',null,'0','1370','sellbillController.php?do=showDetail&sellbillid=1370'); -- id=4678
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4678', '402', '28566', '','0'); -- id=4812
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14316546.31', 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 ('4678', '382', '28566', '','0'); -- id=4680
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27748575.89', 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='4677,0,4678' where sellbillid=1370;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 30250, 29058, 29058
                    , 29044.44, 28566, 28654.44, 28576.05
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29058, 28024.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30250, sellCostBuyPrice =sellCostBuyPrice+29058
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29058, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29044.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28566, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28654.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28576.05
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29058
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28024.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 30250, 29058, 29058
                    , 29044.44, 28566, 28654.44, 28576.05
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,29058, 28024.44, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+30250, sellCostBuyPrice =sellCostBuyPrice+29058
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+29058, sellCostMeanBuyPrice = sellCostMeanBuyPrice+29044.44
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+28566, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+28654.44
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+28576.05
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+29058
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+28024.44
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 30250, 29058, 29058
                    , 29044.44, 28566, 28654.44, 28576.05, 29058, 28024.44)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+30250, netSellCostBuyPrice = netSellCostBuyPrice+29058
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+29058
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+29044.44
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+28566
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+28654.44
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+28576.05
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+29058
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+28024.44;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada2b639302f and sellbillId = 1370 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:07:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:37:35", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:37:35', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18934
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:14:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:44:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:44:51', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18935
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:16:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:46:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:46:11', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18936

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada2dbf49a7d
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada2dbf49a7d and sellbillId = 1371 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:16:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:46:11", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:46:11', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18937
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:17:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:47:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:47:11', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18938
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:18:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:48:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:48:15', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=18939
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:18:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:48:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:48:34', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18940
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:18:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:48:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 18:48:39', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=18941
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:18:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:48:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:48:41', '4', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18942

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada240d5ee0d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 18:48:41', '06ada240d5ee0d', '1', '0.00', '0', '0', '1', '4185.00', '4185', '4185', '0', '2', '2026-10-22 18:48:41', '', '4', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '6' ,'0','','','','','-1','0','0','0','0','0','4185','0','','0','0','4185','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1372
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1372', '0', '2026-10-22 18:48:41', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '4185', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 18:48:41','0','0','',''); -- id=1608
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6311;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','02115', '1372', '181', '2115', '3', '850', '2550', '0', '', '0', '2026-10-22 18:48:41', '2115', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6311-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=5451
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5451;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2115, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '4', storedetaildate = '2026-10-22 18:48:41' WHERE storedetailid = '3552';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2115', '2', '3', '1', '1372', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '27', '4', '2026-10-22 18:48:41','0','0'); -- id=17126
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6323;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('495','02078', '1372', '172', '2078', '3', '545', '1635', '0', '', '0', '2026-10-22 18:48:41', '2078', '0.00', '-1', '2','0.00','','','0','0','0','0','0','0','0','0','','6323-3,','1','1','0','0','545','1635','0','','0','0.00','0','0','0','0'); -- id=5452
UPDATE sellbilldetail SET  lastbuyprice = 495.00 , meanbuyprice = 495.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 242.23, lastbuyprice_withDiscountAndTax = 495
                where sellbilldetailid = 5452;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2078, '2026-10-22', 1635, 1485, 1485
                    , 1485, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1485, 726.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1485
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1485, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1485
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1485
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+726.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2, '2026-10-22', 1635, 1485, 1485
                    , 1485, 1485, 1485, 1485
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1485, 726.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1635, sellCostBuyPrice =sellCostBuyPrice+1485
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1485, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1485
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1485, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1485
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1485
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1485
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+726.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '21', userid = '4', storedetaildate = '2026-10-22 18:48:41' WHERE storedetailid = '3558';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2078', '2', '3', '1', '1372', 'اضافة فاتورة مبيعات', 'sellbillController.php', '24', '21', '4', '2026-10-22 18:48:41','0','0'); -- id=17127
CALL saveInUse(3,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1304287.875',  userid = '4' WHERE saveid = '3';
UPDATE save SET  inUse = 0 where saveid = 3;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1300102.875','4185', '0', '3', 'اضافة فاتورة مبيعات', '1372', '1304287.875', '2026-10-22 18:48:41', '4',  'sellbillController.php','1','','0'); -- id=1682
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4185', '4185', '2026-10-22', '4', '0', '0', '2026-10-22 18:48:41','اضافة فاتورة مبيعات رقم 1372','1','0',null,'0','1372','sellbillController.php?do=showDetail&sellbillid=1372'); -- id=4681
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4681', '501', '4185', '','0'); -- id=4815
UPDATE accountstree SET name = 'خزينه المحل الارضي', customName = 'خزينه المحل الارضي', customNameEn = 'خزينه المحل الارضي', nameEn = 'خزينه المحل الارضي', parent = '40', accountNature = '0', theValue = '1304287.9', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-30 21:35:47' WHERE id = '501';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4681', '143', '4185', '','0'); -- id=4683
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15483280', 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 ( '3885', '3885', '2026-10-22', '4', '0', '0', '2026-10-22 18:48:41','اضافة فاتورة مبيعات رقم 1372 - صرف البضاعة من المخزن','1','0',null,'0','1372','sellbillController.php?do=showDetail&sellbillid=1372'); -- id=4682
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4682', '402', '3885', '','0'); -- id=4816
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14324131.31', 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 ('4682', '492', '3885', '','0'); -- id=4684
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1453661', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
update sellbill set dailyentryid='4681,0,4682' where sellbillid=1372;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 4185, 3885, 3885
                    , 3885, 3885, 3885, 3885
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3885, 3126.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+3885
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3885, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3885
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3885, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3885
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3885
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3885
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3126.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 4185, 3885, 3885
                    , 3885, 3885, 3885, 3885
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,3885, 3126.69, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+4185, sellCostBuyPrice =sellCostBuyPrice+3885
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3885, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3885
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3885, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3885
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3885
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3885
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3126.69
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 4185, 3885, 3885
                    , 3885, 3885, 3885, 3885, 3885, 3126.69)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+4185, netSellCostBuyPrice = netSellCostBuyPrice+3885
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+3885
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+3885
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+3885
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+3885
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+3885
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+3885
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+3126.69;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada240d5ee0d and sellbillId = 1372 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:18:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:48:41", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:48:41', '4', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18943
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 18:49:13', '1', 'add2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=18944
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('العمده شروال','2026-10-22','','41', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=218
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (218, 1,'2026-10-22 18:49:13',1)
                ON DUPLICATE KEY UPDATE catid = 218, edited = 1, sysdate = '2026-10-22 18:49:13', userid = 1; -- id=233
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '218', '1', '2026-10-22', '1', '0'); -- id=106
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 18:49:13', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=18945
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 18:49:15', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=18946
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:49:18', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=18947
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:49:54', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=18948
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('اسفنجي العمده','','218','325','325','0','0','2026-10-22','0','1','0','','0','0','0','0','0','325','325','325','325','325','0','0','0','0','.','0','0','0','325','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','325','325','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','325','0','0','0','0','0','0','','','0','0','0','0'); -- id=2473
UPDATE product SET productName = 'اسفنجي العمده', productDescription = '', productCatId = '218', productBuyPrice = '325', productSellAllPrice = '325', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02473',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '325',lastbuyprice_withDiscount = '325',meanbuyprice = '325',meanbuyprice_withDiscount = '325' , productbuypricereal = '325' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='325',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='325',meanbuyprice_withTax='325',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='325',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2473';
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', '2473', '1.00', '2026-10-22', '1', '0','0247301','325','0','0','325','','0','0','0','0','0','0','0','0','0','0'); -- id=2473
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2473', '1', '0', '1', '2026-10-22'); -- id=3868
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2473', '1', '0', '0', '2473', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-22','0','0'); -- id=17128
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2473, 1,'2026-10-22 18:49:54',1)
                ON DUPLICATE KEY UPDATE productid = 2473, edited = 1, sysdate = '2026-10-22 18:49:54', userid = 1; -- id=3697
UPDATE product SET productName = 'اسفنجي العمده', productDescription = '', productCatId = '218', productBuyPrice = '325.00', productSellAllPrice = '325.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02473',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '325',lastbuyprice_withDiscount = '325',meanbuyprice = '325',meanbuyprice_withDiscount = '325' , productbuypricereal = '325' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='325',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='325',meanbuyprice_withTax='325',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='325',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2473';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:19:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:49:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:49:55', '1', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=18949
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:21:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:51:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:51:05', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=18950
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 ('06ada30a3cc629', '2026-10-22 18:49:55', '181', '137976.00', '158685', '10', '1', '23010.00',  '20709.00', '0', '20709', '1', '2026-10-22 18:51:05', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=355
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 ('02086', '355', '174', '2086', '51', '260', '13260.00', '0', '', '2026-10-22 18:51:05', '2086','','','0','0','0','0','0',null,'260','13260','0','0','0','0','0','0','0','0','1'); -- id=1858
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:49:55', 1, 2086, 0, 0
                    , 234, 51, 0, 0, 1, '2026-10-22 18:51:05')
                ON DUPLICATE KEY UPDATE buyprice = 234,
                        buyQuantity =buyQuantity+51, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 18:51:05' ; -- id=7190
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2086', '260', '51', '0', 'buyBillController.php', '1858', '', '0', '0'); -- id=1398
UPDATE product SET  productBuyPrice = "260" WHERE productId = 2086 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1858 ;
UPDATE product SET productName = 'شروال 260 العمده', productDescription = '', productCatId = '174', productBuyPrice = '260.00', productSellAllPrice = '260.00', productSellUnitPrice = '260.00', productSellHalfPrice = '260.00', productDate = '2026-10-14', conditions = '0', userId = '1', limitamount = '0', parcode = '02086',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '234',meanbuyprice = '260',meanbuyprice_withDiscount = '234' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='234',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='234',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2086';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 260, lastbuyprice_withDiscount = 234, meanbuyprice_withDiscount = 234
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 234
                where buybilldetailid = 1858;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 2086;
UPDATE storedetail SET  productquantity = '51', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3445';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2086', '1', '51', '0', '355', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '51', '1', '2026-10-22 18:49:55','0','0'); -- id=17129
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 ('02473', '355', '218', '2473', '30', '325', '9750.00', '0', '', '2026-10-22 18:51:05', '2473','','','0','0','0','0','0',null,'325','9750','0','0','0','0','0','0','0','0','1'); -- id=1859
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:49:55', 1, 2473, 0, 0
                    , 292.5, 30, 0, 0, 1, '2026-10-22 18:51:05')
                ON DUPLICATE KEY UPDATE buyprice = 292.5,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 18:51:05' ; -- id=7191
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2473', '325', '30', '0', 'buyBillController.php', '1859', '', '0', '0'); -- id=1399
UPDATE product SET  productBuyPrice = "325" WHERE productId = 2473 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1859 ;
UPDATE product SET productName = 'اسفنجي العمده', productDescription = '', productCatId = '218', productBuyPrice = '325.00', productSellAllPrice = '325.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02473',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '325',lastbuyprice_withDiscount = '292.5',meanbuyprice = '325',meanbuyprice_withDiscount = '292.5' , productbuypricereal = '325.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='325',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='325',meanbuyprice_withTax='325',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='292.5',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2473';
UPDATE buybilldetail SET  lastbuyprice = 325 , meanbuyprice = 325, lastbuyprice_withDiscount = 292.5, meanbuyprice_withDiscount = 292.5
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 292.5
                where buybilldetailid = 1859;
UPDATE productunit SET proUnitBuyPrice  = 325 * productnumber WHERE productid = 2473;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3868';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2473', '1', '30', '0', '355', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-22 18:49:55','0','0'); -- id=17130
UPDATE supplier SET  suppliercurrentDebt = '158685',suppliercurrentDebtInCurrency= '158685' , userid = '1', supplierdate = '2026-10-22 18:51:05'   WHERE supplierid = '181';
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 ('181', '137976.00', '20709', '0', 'اضافة فاتورة مشتريات', '355', '158685', '2026-10-22 18:49:55', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','20709','1','137976','20709','158685','0',''); -- id=908
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20709', '20709', '2026-10-22', '1', '0', '0', '2026-10-22 18:51:05','اضافة فاتورة مشتريات رقم 355','1','0',null,'0','355','buyBillController.php?do=details&id=355'); -- id=4683
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4683', '382', '20709', '','0'); -- id=4817
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27765584.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4683', '664', '20709', '','0'); -- id=4685
UPDATE accountstree SET name = 'العمدة', customName = 'العمدة', customNameEn = 'العمدة', nameEn = 'العمدة', parent = '81', accountNature = '1', theValue = '158685', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-14 22:23:12' WHERE id = '664';
update buybill set dailyentryid='4683,0' where buybillid=355;
COMMIT;
UPDATE product SET overAllAveragePrice = 234 WHERE productId = 2086;UPDATE product SET overAllAveragePrice = 292.5 WHERE productId = 2473;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:21:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:51:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 18:51:05', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=355'); -- id=18951
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:21:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:51:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 18:51:09', '1', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=355&type=2'); -- id=18952
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:21:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:51:53", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:51:53', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18953

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada2fc39d06b
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada2fc39d06b and sellbillId = 1373 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:21:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:51:54", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:51:54', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18954
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:22:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:52:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:52:44', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18955

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada311a3cf9f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada311a3cf9f and sellbillId = 1374 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:22:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:52:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:52:45', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18956
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:24:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:54:55", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 18:54:55', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=18957
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:07", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:07', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18958
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:09", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:09', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18959

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada28b3943ad
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada28b3943ad and sellbillId = 1375 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:10", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:10', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18960
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:22", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:22', '6', 'showDetail', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=showDetail&sellbillid=1375'); -- id=18961
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:41", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:41', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18962
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:51", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:51', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18963

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada31fd5afd6
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada31fd5afd6 and sellbillId = 1376 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:25:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 18:55:51", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 18:55:51', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18964
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:34:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:04:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:04:32', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18965

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada31dc0a56d
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 19:04:32', '06ada31dc0a56d', '1', '0.00', '0', '0', '1', '11190.00', '11190', '11190', '0', '1', '2026-10-22 19:04:32', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '38' ,'0','','','','','-1','0','0','0','0','0','11190','0','','0','0','11190','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1377
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1377', '0', '2026-10-22 19:04:32', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '11190', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 19:04:32','0','0','',''); -- id=1613
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 7191;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('292.5','02473', '1377', '218', '2473', '6', '325', '1950', '0', '', '0', '2026-10-22 19:04:32', '2473', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7191-6,','1','1','0','0','325','1950','0','','0','0.00','0','0','0','0'); -- id=5460
UPDATE sellbilldetail SET  lastbuyprice = 325.00 , meanbuyprice = 325.00, lastbuyprice_withDiscount = 292.50, meanbuyprice_withDiscount = 292.50
        , lastbuyprice_withTax = 325, meanbuyprice_withTax = 325, lastbuyprice_withDiscountAndTax = 292.5
                where sellbilldetailid = 5460;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2473, '2026-10-22', 1950, 1950, 1950
                    , 1950, 1755, 1755, 1755
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1755, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1755
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1755
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1950, 1950, 1950
                    , 1950, 1755, 1755, 1755
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1950, 1950, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1950, sellCostBuyPrice =sellCostBuyPrice+1950
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1950, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1950
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1755, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1755
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1755
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1950
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1950
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 19:04:32' WHERE storedetailid = '3868';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2473', '1', '6', '1', '1377', 'اضافة فاتورة مبيعات', 'sellbillController.php', '30', '24', '2', '2026-10-22 19:04:32','0','0'); -- id=17138
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+8 where id = 7005;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','02371', '1377', '69', '2371', '8', '375', '3000', '0', '', '0', '2026-10-22 19:04:32', '2371', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','7005-8,','1','1','0','0','375','3000','0','','0','0.00','0','0','0','0'); -- id=5461
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 360.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 180, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5461;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2371, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8, 0, 2880, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+8
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 1440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '4', userid = '2', storedetaildate = '2026-10-22 19:04:32' WHERE storedetailid = '3765';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2371', '1', '8', '1', '1377', 'اضافة فاتورة مبيعات', 'sellbillController.php', '12', '4', '2', '2026-10-22 19:04:32','0','0'); -- id=17139
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+24 where id = 7190;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('234','02086', '1377', '174', '2086', '24', '260', '6240', '0', '', '0', '2026-10-22 19:04:32', '2086', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7190-24,','1','1','0','0','260','6240','0','','0','0.00','0','0','0','0'); -- id=5462
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 234.00, meanbuyprice_withDiscount = 234.00
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 234
                where sellbilldetailid = 5462;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2086, '2026-10-22', 6240, 6240, 6240
                    , 6240, 5616, 5616, 5616
                    , 0, 0, 0, 0
                    , 0, 0, 0, 24, 0, 6240, 6240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6240, sellCostBuyPrice =sellCostBuyPrice+6240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+24
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6240, 6240, 6240
                    , 6240, 5616, 5616, 5616
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6240, 6240, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6240, sellCostBuyPrice =sellCostBuyPrice+6240
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6240, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6240
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+5616, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+5616
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+5616
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6240
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6240
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '2', storedetaildate = '2026-10-22 19:04:32' WHERE storedetailid = '3445';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2086', '1', '24', '1', '1377', 'اضافة فاتورة مبيعات', 'sellbillController.php', '51', '27', '2', '2026-10-22 19:04:32','0','0'); -- id=17140
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8856081',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8844891','11190', '0', '2', 'اضافة فاتورة مبيعات', '1377', '8856081', '2026-10-22 19:04:32', '2',  'sellbillController.php','1','','0'); -- id=1687
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '11190', '11190', '2026-10-22', '2', '0', '0', '2026-10-22 19:04:32','اضافة فاتورة مبيعات رقم 1377','1','0',null,'0','1377','sellbillController.php?do=showDetail&sellbillid=1377'); -- id=4692
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4692', '419', '11190', '','0'); -- id=4826
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8856080.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4692', '143', '11190', '','0'); -- id=4694
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15518345', 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 ( '10251', '10251', '2026-10-22', '2', '0', '0', '2026-10-22 19:04:32','اضافة فاتورة مبيعات رقم 1377 - صرف البضاعة من المخزن','1','0',null,'0','1377','sellbillController.php?do=showDetail&sellbillid=1377'); -- id=4693
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4693', '402', '10251', '','0'); -- id=4827
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14354972.31', 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 ('4693', '382', '10251', '','0'); -- id=4695
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27734743.89', 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='4692,0,4693' where sellbillid=1377;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 11190, 11070, 11070
                    , 11070, 10251, 10251, 10251
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11070, 9630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11190, sellCostBuyPrice =sellCostBuyPrice+11070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10251, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10251
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10251
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11070
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 11190, 11070, 11070
                    , 11070, 10251, 10251, 10251
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,11070, 9630, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+11190, sellCostBuyPrice =sellCostBuyPrice+11070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+11070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+11070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+10251, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+10251
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+10251
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+11070
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9630
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 11190, 11070, 11070
                    , 11070, 10251, 10251, 10251, 11070, 9630)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+11190, netSellCostBuyPrice = netSellCostBuyPrice+11070
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+11070
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+11070
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+10251
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+10251
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+10251
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+11070
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+9630;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada31dc0a56d and sellbillId = 1377 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:34:32";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:04:32", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:04:32', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18966
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:36:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:06:12", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:06:12', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18967

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada3410c9853
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada3410c9853 and sellbillId = 1378 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:36:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:06:13", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:06:13', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18968
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:37:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:07:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:07:29', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18969
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:37:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:07:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:07:41', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18970

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada34c1b578e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 19:07:41', '06ada34c1b578e', '1', '0.00', '0', '0', '1', '550', '550', '-550', '0', '1', '2026-10-22 19:07:41', '', '2', '0', 'نقدي','2', '0', '5', '0', 'نقدي', '1', '0', '', '','','','-1','0','0','0','','0','-550','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=50
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','50', '0', '2026-10-22 19:07:41', '2', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '550', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 19:07:41','0','0','',''); -- id=1615
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('535.00', '02047', '50', '42', '2047', '1', '550', '550', '0', '', '0', '0', '2047', '0.00', '0','1','0','','','0','0','0','0','0','0','1','1','','0','0','550','550','0','','0'); -- id=73
UPDATE returnsellbilldetail SET  lastbuyprice = 535.00 , meanbuyprice = 535.00, lastbuyprice_withDiscount = 535.00, meanbuyprice_withDiscount = 535.00
        , lastbuyprice_withTax = 535, meanbuyprice_withTax = 535, lastbuyprice_withDiscountAndTax = 535
                where returnsellbilldetailid = 73;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2047, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 550, 535, 535, 535
                    , 535, 535, 535, 0, 1, 0, 0, 535, 535)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+550, returnSellCostBuyPrice = returnSellCostBuyPrice+535, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+535
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+535, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+535
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+535
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+535
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+535
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+535
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+1;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 550, 535, 535, 535
                    , 535, 535, 535, 0, 0, 535, 535)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+550, returnSellCostBuyPrice = returnSellCostBuyPrice+535, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+535
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+535, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+535
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+535
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+535
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+535
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+535;
UPDATE storedetail SET  productquantity = '28', userid = '2', storedetaildate = '2026-10-22 19:07:41' WHERE storedetailid = '3406';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2047', '1', '1', '0', '50', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '27', '28', '2', '2026-10-22 19:07:41','0','0'); -- id=17142
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8856611',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8857161','-550', '1', '2', 'اضافة فاتورة مردوات مبيعات', '50', '8856611', '2026-10-22 19:07:41', '2',  'returnsellbillController.php','1','','0'); -- id=1689
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '550', '550', '2026-10-22', '2', '0', '0', '2026-10-22 19:07:41','اضافة فاتورة مردود مبيعات رقم 50','1','0',null,'0','50','returnsellbillController.php?do=showDetail&returnsellbillid=50'); -- id=4696
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4696', '143', '550', '','0'); -- id=4830
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15518875', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4696', '419', '550', '','0'); -- id=4698
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8856610.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '535', '535', '2026-10-22', '2', '0', '0', '2026-10-22 19:07:41','اضافة فاتورة مردود مبيعات رقم 50 - صرف البضاعة من المخزن','1','0',null,'0','50','returnsellbillController.php?do=showDetail&returnsellbillid=50'); -- id=4697
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4697', '382', '535', '','0'); -- id=4831
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27734285.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4697', '402', '535', '','0'); -- id=4699
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14355430.91', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4696,0,4697' where returnsellbillid=50;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 550, 535, 535, 535
                    , 535, 535, 535 ,0, 0, 535, 535)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+550, returnSellCostBuyPrice = returnSellCostBuyPrice+535, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+535
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+535, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+535
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+535
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+535
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+535
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+535;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 550, 535, 535, 535
                    , 535, 535, 535 ,0, 0, 535, 535)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+550, returnSellCostBuyPrice = returnSellCostBuyPrice+535, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+535
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+535, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+535
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+535
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+535
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+535
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+535;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -550, -535, -535
                    , -535, -535, -535, -535, -535, -535)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-550, netSellCostBuyPrice = netSellCostBuyPrice+-535
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-535
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-535
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-535
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-535
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-535
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-535
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-535;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada34c1b578e and sellbillId = 50 and returnsellbillId = 50
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:37:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:07:41", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:07:41', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=18971
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:39:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:09:44", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:09:44', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18972

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada347533002
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada347533002 and sellbillId = 1379 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:39:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:09:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:09:45', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18973
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:41:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:11:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 19:11:22', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18974
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:41:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:11:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 19:11:27', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18975
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:41:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:11:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:11:37', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=18976
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:41:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:11:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:11:51', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18977
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:55:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:25:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:25:08', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=18978
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:55:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:25:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:25:20', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18979
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:55:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:25:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:25:42', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php?do=show'); -- id=18980
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:55:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:25:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 19:25:57', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php'); -- id=18981
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:55:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:25:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillreportController.php', '2026-10-22 19:25:58', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillreportController.php?do=show'); -- id=18982
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:57:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:27:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('billsettingsController.php', '2026-10-22 19:27:12', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/billsettingsController.php?do=show'); -- id=18983
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:57:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:27:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:27:20', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18984
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:57:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:27:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:27:51', '1', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=330'); -- id=18985
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:28:26', '1', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=18986
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 330;
UPDATE buybill SET  buybillsysdate = '2026-10-22 19:28:26', userid = '5',delbyuserid = '1', conditions = '1' WHERE buybillid = '330';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2176, 0, 0
                    , 310, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7096
UPDATE product SET productName = 'اوفر سايز 330 استوب', productDescription = '', productCatId = '190', productBuyPrice = '310.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02176',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.45' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '2176';
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 2176;
UPDATE storedetail SET  productquantity = '17', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '53', '17', '1', '2026-10-22 11:46:07','0','0'); -- id=17145
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2175, 0, 0
                    , 230, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7097
UPDATE product SET productName = 'تلبيس عادي استوب', productDescription = '', productCatId = '190', productBuyPrice = '230.00', productSellAllPrice = '245.00', productSellUnitPrice = '245.00', productSellHalfPrice = '245.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02175',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '230',lastbuyprice_withDiscount = '230',meanbuyprice = '230',meanbuyprice_withDiscount = '230' , productbuypricereal = '230.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='230',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='230',meanbuyprice_withTax='230',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2175';
UPDATE productunit SET proUnitBuyPrice  = 230 * productnumber WHERE productid = 2175;
UPDATE storedetail SET  productquantity = '-8', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3535';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2175', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '28', '-8', '1', '2026-10-22 11:46:07','0','0'); -- id=17146
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2424, 0, 0
                    , 350, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7098
UPDATE buybilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 350.00
                where buybilldetailid = 1772;
UPDATE product SET productName = 'موديل 122 استوب', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '0',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2424';
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2424;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3819';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2424', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '36', '0', '1', '2026-10-22 11:46:07','0','0'); -- id=17147
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2425, 0, 0
                    , 300, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7099
UPDATE buybilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 300.00, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 300.00
        , lastbuyprice_withTax = 300.00, meanbuyprice_withTax = 300.00, lastbuyprice_withDiscountAndTax = 300.00
                where buybilldetailid = 1773;
UPDATE product SET productName = 'موديل 119 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '300.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '0',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.67' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '2425';
UPDATE productunit SET proUnitBuyPrice  = 300 * productnumber WHERE productid = 2425;
UPDATE storedetail SET  productquantity = '-28', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '8', '-28', '1', '2026-10-22 11:46:07','0','0'); -- id=17148
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2426, 0, 0
                    , 390, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7100
UPDATE buybilldetail SET  lastbuyprice = 390.00 , meanbuyprice = 390.00, lastbuyprice_withDiscount = 390.00, meanbuyprice_withDiscount = 390.00
        , lastbuyprice_withTax = 390.00, meanbuyprice_withTax = 390.00, lastbuyprice_withDiscountAndTax = 390.00
                where buybilldetailid = 1774;
UPDATE product SET productName = 'موديل 142 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '390.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '0',meanbuyprice = '390.00',meanbuyprice_withDiscount = '390' , productbuypricereal = '390.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.13' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='390',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2426';
UPDATE productunit SET proUnitBuyPrice  = 390 * productnumber WHERE productid = 2426;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3821';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2426', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '36', '0', '1', '2026-10-22 11:46:07','0','0'); -- id=17149
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2427, 0, 0
                    , 450, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7101
UPDATE buybilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450.00, meanbuyprice_withTax = 450.00, lastbuyprice_withDiscountAndTax = 450.00
                where buybilldetailid = 1775;
UPDATE product SET productName = 'موديل 127 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '0',meanbuyprice = '450.00',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2427';
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2427;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3822';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2427', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '36', '0', '1', '2026-10-22 11:46:07','0','0'); -- id=17150
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2428, 0, 0
                    , 350, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7102
UPDATE buybilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 350.00
                where buybilldetailid = 1776;
UPDATE product SET productName = 'موديل 137 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '0',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '2428';
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2428;
UPDATE storedetail SET  productquantity = '-4', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3823';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2428', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '32', '-4', '1', '2026-10-22 11:46:07','0','0'); -- id=17151
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2429, 0, 0
                    , 355, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7103
UPDATE buybilldetail SET  lastbuyprice = 355.00 , meanbuyprice = 355.00, lastbuyprice_withDiscount = 355.00, meanbuyprice_withDiscount = 355.00
        , lastbuyprice_withTax = 355.00, meanbuyprice_withTax = 355.00, lastbuyprice_withDiscountAndTax = 355.00
                where buybilldetailid = 1777;
UPDATE product SET productName = 'موديل 145 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '355.00', productSellAllPrice = '375.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '0',meanbuyprice = '355.00',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.63' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2429';
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2429;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3824';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2429', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '36', '0', '1', '2026-10-22 11:46:07','0','0'); -- id=17152
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2430, 0, 0
                    , 260, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-36, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7104
UPDATE buybilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
        , lastbuyprice_withTax = 260.00, meanbuyprice_withTax = 260.00, lastbuyprice_withDiscountAndTax = 260.00
                where buybilldetailid = 1778;
UPDATE product SET productName = 'موديل 149 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '0',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.77' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '2430';
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 2430;
UPDATE storedetail SET  productquantity = '-8', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3825';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2430', '1', '36', '1', '330', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '28', '-8', '1', '2026-10-22 11:46:07','0','0'); -- id=17153
UPDATE supplier SET  suppliercurrentDebt = '0',suppliercurrentDebtInCurrency= '-3150' , userid = '1', supplierdate = '2026-10-22 19:28:26'   WHERE supplierid = '1';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('1', '107820.00', '107820.00', '1', 'حذف فاتورة مشتريات - للتعديل', '330', '0', '2026-10-22 11:46:07', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','107820','1','104670','107820','-3150','0',''); -- id=909
UPDATE productserial SET del = 1
		 WHERE billid = 330;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ad9cd4f37ac8', '2026-10-22 11:46:07', '163', '22110.00', '129930', '0', '0', '107820.00', '107820.00', '0.00', '107820', '1', '2026-10-22 19:28:26', '', '1', '0', '', '1', '1','1','330','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=356
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 ('02176', '356', '190', '2176', '36.00', '310', '11160.00', '0.00', '', '2026-10-22 19:28:26', '2176','','','0','0','0','0','0',null,'310','11160','0','0','0','0','0','0','0','0','1'); -- id=1860
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2176, 0, 0
                    , 310, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 310,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7096
UPDATE product SET  productBuyPrice = "310" WHERE productId = 2176 ;
UPDATE buybilldetail SET  quantitybefore = 17 WHERE buybilldetailid = 1860 ;
UPDATE product SET productName = 'اوفر سايز 330 استوب', productDescription = '', productCatId = '190', productBuyPrice = '310.00', productSellAllPrice = '330.00', productSellUnitPrice = '330.00', productSellHalfPrice = '330.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02176',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '310',lastbuyprice_withDiscount = '310',meanbuyprice = '310',meanbuyprice_withDiscount = '310' , productbuypricereal = '310.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.45' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='310',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='310',meanbuyprice_withTax='310',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='310',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2176';
UPDATE buybilldetail SET  lastbuyprice = 310 , meanbuyprice = 310, lastbuyprice_withDiscount = 310, meanbuyprice_withDiscount = 310
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where buybilldetailid = 1860;
UPDATE productunit SET proUnitBuyPrice  = 310 * productnumber WHERE productid = 2176;
UPDATE storedetail SET  productquantity = '53', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3536';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2176', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '17', '53', '1', '2026-10-22 11:46:07','0','0'); -- id=17154
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 ('02175', '356', '190', '2175', '36.00', '230', '8280.00', '0.00', '', '2026-10-22 19:28:26', '2175','','','0','0','0','0','0',null,'230','8280','0','0','0','0','0','0','0','0','1'); -- id=1861
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2175, 0, 0
                    , 230, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 230,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7097
UPDATE product SET  productBuyPrice = "230" WHERE productId = 2175 ;
UPDATE buybilldetail SET  quantitybefore = -8 WHERE buybilldetailid = 1861 ;
UPDATE product SET productName = 'تلبيس عادي استوب', productDescription = '', productCatId = '190', productBuyPrice = '230.00', productSellAllPrice = '245.00', productSellUnitPrice = '245.00', productSellHalfPrice = '245.00', productDate = '2026-10-15', conditions = '0', userId = '1', limitamount = '0', parcode = '02175',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '230',lastbuyprice_withDiscount = '230',meanbuyprice = '230',meanbuyprice_withDiscount = '230' , productbuypricereal = '230.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.52' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='230',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='230',meanbuyprice_withTax='230',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='230',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2175';
UPDATE buybilldetail SET  lastbuyprice = 230 , meanbuyprice = 230, lastbuyprice_withDiscount = 230, meanbuyprice_withDiscount = 230
        , lastbuyprice_withTax = 230, meanbuyprice_withTax = 230, lastbuyprice_withDiscountAndTax = 230
                where buybilldetailid = 1861;
UPDATE productunit SET proUnitBuyPrice  = 230 * productnumber WHERE productid = 2175;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3535';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2175', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-8', '28', '1', '2026-10-22 11:46:07','0','0'); -- id=17155
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 ('02424', '356', '190', '2424', '36.00', '350', '12600.00', '0.00', '', '2026-10-22 19:28:26', '2424','','','0','0','0','0','0',null,'350','12600','0','0','0','0','0','0','0','0','1'); -- id=1862
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2424, 0, 0
                    , 350, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7098
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2424 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1862 ;
UPDATE product SET productName = 'موديل 122 استوب', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02424',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='175',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2424';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1862;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2424;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3819';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2424', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-22 11:46:07','0','0'); -- id=17156
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 ('02425', '356', '190', '2425', '36.00', '300', '10800.00', '0.00', '', '2026-10-22 19:28:26', '2425','','','0','0','0','0','0',null,'300','10800','0','0','0','0','0','0','0','0','1'); -- id=1863
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2425, 0, 0
                    , 300, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 300,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7099
UPDATE product SET  productBuyPrice = "300" WHERE productId = 2425 ;
UPDATE buybilldetail SET  quantitybefore = -28 WHERE buybilldetailid = 1863 ;
UPDATE product SET productName = 'موديل 119 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '300.00', productSellAllPrice = '320.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02425',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '300',lastbuyprice_withDiscount = '300',meanbuyprice = '300',meanbuyprice_withDiscount = '300' , productbuypricereal = '300.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.67' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='300',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='300',meanbuyprice_withTax='300',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='300',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2425';
UPDATE buybilldetail SET  lastbuyprice = 300 , meanbuyprice = 300, lastbuyprice_withDiscount = 300, meanbuyprice_withDiscount = 300
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 300, lastbuyprice_withDiscountAndTax = 300
                where buybilldetailid = 1863;
UPDATE productunit SET proUnitBuyPrice  = 300 * productnumber WHERE productid = 2425;
UPDATE storedetail SET  productquantity = '8', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3820';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2425', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-28', '8', '1', '2026-10-22 11:46:07','0','0'); -- id=17157
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 ('02426', '356', '190', '2426', '36.00', '390', '14040.00', '0.00', '', '2026-10-22 19:28:26', '2426','','','0','0','0','0','0',null,'390','14040','0','0','0','0','0','0','0','0','1'); -- id=1864
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2426, 0, 0
                    , 390, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 390,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7100
UPDATE product SET  productBuyPrice = "390" WHERE productId = 2426 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1864 ;
UPDATE product SET productName = 'موديل 142 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '390.00', productSellAllPrice = '410.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02426',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '390',lastbuyprice_withDiscount = '390',meanbuyprice = '390',meanbuyprice_withDiscount = '390' , productbuypricereal = '390.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.13' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='390',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='390',meanbuyprice_withTax='195',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='390',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2426';
UPDATE buybilldetail SET  lastbuyprice = 390 , meanbuyprice = 390, lastbuyprice_withDiscount = 390, meanbuyprice_withDiscount = 390
        , lastbuyprice_withTax = 390, meanbuyprice_withTax = 195, lastbuyprice_withDiscountAndTax = 390
                where buybilldetailid = 1864;
UPDATE productunit SET proUnitBuyPrice  = 390 * productnumber WHERE productid = 2426;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3821';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2426', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-22 11:46:07','0','0'); -- id=17158
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 ('02427', '356', '190', '2427', '36.00', '450', '16200.00', '0.00', '', '2026-10-22 19:28:26', '2427','','','0','0','0','0','0',null,'450','16200','0','0','0','0','0','0','0','0','1'); -- id=1865
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2427, 0, 0
                    , 450, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 450,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7101
UPDATE product SET  productBuyPrice = "450" WHERE productId = 2427 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1865 ;
UPDATE product SET productName = 'موديل 127 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '450.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02427',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450',lastbuyprice_withDiscount = '450',meanbuyprice = '450',meanbuyprice_withDiscount = '450' , productbuypricereal = '450.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.44' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='450',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='450',meanbuyprice_withTax='225',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='450',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2427';
UPDATE buybilldetail SET  lastbuyprice = 450 , meanbuyprice = 450, lastbuyprice_withDiscount = 450, meanbuyprice_withDiscount = 450
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 225, lastbuyprice_withDiscountAndTax = 450
                where buybilldetailid = 1865;
UPDATE productunit SET proUnitBuyPrice  = 450 * productnumber WHERE productid = 2427;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3822';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2427', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-22 11:46:07','0','0'); -- id=17159
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 ('02428', '356', '190', '2428', '36.00', '350', '12600.00', '0.00', '', '2026-10-22 19:28:26', '2428','','','0','0','0','0','0',null,'350','12600','0','0','0','0','0','0','0','0','1'); -- id=1866
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2428, 0, 0
                    , 350, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7102
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2428 ;
UPDATE buybilldetail SET  quantitybefore = -4 WHERE buybilldetailid = 1866 ;
UPDATE product SET productName = 'موديل 137 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '350.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02428',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.71' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='350',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2428';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1866;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2428;
UPDATE storedetail SET  productquantity = '32', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3823';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2428', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-4', '32', '1', '2026-10-22 11:46:07','0','0'); -- id=17160
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 ('02429', '356', '190', '2429', '36.00', '355', '12780.00', '0.00', '', '2026-10-22 19:28:26', '2429','','','0','0','0','0','0',null,'355','12780','0','0','0','0','0','0','0','0','1'); -- id=1867
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2429, 0, 0
                    , 355, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 355,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7103
UPDATE product SET  productBuyPrice = "355" WHERE productId = 2429 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1867 ;
UPDATE product SET productName = 'موديل 145 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '355.00', productSellAllPrice = '375.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02429',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.63' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='177.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2429';
UPDATE buybilldetail SET  lastbuyprice = 355 , meanbuyprice = 355, lastbuyprice_withDiscount = 355, meanbuyprice_withDiscount = 355
        , lastbuyprice_withTax = 355, meanbuyprice_withTax = 177.5, lastbuyprice_withDiscountAndTax = 355
                where buybilldetailid = 1867;
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2429;
UPDATE storedetail SET  productquantity = '36', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3824';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2429', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '36', '1', '2026-10-22 11:46:07','0','0'); -- id=17161
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 ('02430', '356', '190', '2430', '36.00', '260', '9360.00', '0.00', '', '2026-10-22 19:28:26', '2430','','','0','0','0','0','0',null,'260','9360','0','0','0','0','0','0','0','0','1'); -- id=1868
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 11:46:07', 1, 2430, 0, 0
                    , 260, 36, 0, 0, 1, '2026-10-22 19:28:26')
                ON DUPLICATE KEY UPDATE buyprice = 260,
                        buyQuantity =buyQuantity+36, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:28:26' ; -- id=7104
UPDATE product SET  productBuyPrice = "260" WHERE productId = 2430 ;
UPDATE buybilldetail SET  quantitybefore = -8 WHERE buybilldetailid = 1868 ;
UPDATE product SET productName = 'موديل 149 استوب ', productDescription = '', productCatId = '190', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '5', limitamount = '0', parcode = '02430',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.77' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2430';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 260, lastbuyprice_withDiscount = 260, meanbuyprice_withDiscount = 260
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where buybilldetailid = 1868;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 2430;
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3825';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2430', '1', '36', '0', '356', 'اضافة فاتورة مشتريات', 'buyBillController.php', '-8', '28', '1', '2026-10-22 11:46:07','0','0'); -- id=17162
DELETE FROM productserial WHERE billid = 330
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '129930',suppliercurrentDebtInCurrency= '129930' , userid = '1', supplierdate = '2026-10-22 19:28:26'   WHERE supplierid = '163';
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 ('163', '22110.00', '107820', '0', 'اضافة فاتورة مشتريات', '356', '129930', '2026-10-22 19:28:26', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','107820','1','22110','107820','129930','0',''); -- id=910
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '107820', '107820', '2026-10-22', '1', '0', '0', '2026-10-22 19:28:26','اضافة فاتورة مشتريات رقم 356','1','0',null,'0','356','buyBillController.php?do=details&id=356'); -- id=4700
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4700', '382', '107820', '','0'); -- id=4834
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27828497.29', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4700', '646', '107820', '','0'); -- id=4702
UPDATE accountstree SET name = 'استوب', customName = 'استوب', customNameEn = 'استوب', nameEn = 'استوب', parent = '81', accountNature = '1', theValue = '129930', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 20:30:50' WHERE id = '646';
update buybill set dailyentryid='4700,0' where buybillid=356;
UPDATE product SET overAllAveragePrice = 230 WHERE productId = 2175;UPDATE product SET overAllAveragePrice = 310 WHERE productId = 2176;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2424;UPDATE product SET overAllAveragePrice = 300 WHERE productId = 2425;UPDATE product SET overAllAveragePrice = 390 WHERE productId = 2426;UPDATE product SET overAllAveragePrice = 450 WHERE productId = 2427;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2428;UPDATE product SET overAllAveragePrice = 355 WHERE productId = 2429;UPDATE product SET overAllAveragePrice = 260 WHERE productId = 2430;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:28:26', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=356'); -- id=18987
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 19:28:31', '1', 'oneSupplier', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php?do=oneSupplier'); -- id=18988
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:28:42', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=18989

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada3549476e9
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 19:28:42', '06ada3549476e9', '1', '0.00', '0', '0', '1', '8220.00', '8220', '8220', '0', '1', '2026-10-22 19:28:42', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '15' ,'0','','','','','-1','0','0','0','0','0','8220','0','','0','0','8220','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1380
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1380', '0', '2026-10-22 19:28:42', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8220', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 19:28:42','0','0','',''); -- id=1617
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 522;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01673', '1380', '124', '1673', '6', '500', '3000', '0', '', '0', '2026-10-22 19:28:42', '1673', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','522-6,','1','1','0','0','500','3000','0','','0','0.00','0','0','0','0'); -- id=5466
UPDATE sellbilldetail SET  lastbuyprice = 500.00 , meanbuyprice = 500.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 500, meanbuyprice_withTax = 500, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5466;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1673, '2026-10-22', 3000, 3000, 3000
                    , 3000, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3000, 3000, 3000
                    , 3000, 2760, 2760, 2760
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3000, 3000, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3000, sellCostBuyPrice =sellCostBuyPrice+3000
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3000, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3000
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2760, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2760
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2760
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3000
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3000
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '2', storedetaildate = '2026-10-22 19:28:42' WHERE storedetailid = '2685';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1673', '1', '6', '1', '1380', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '15', '2', '2026-10-22 19:28:42','0','0'); -- id=17163
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 520;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('542.8','01671', '1380', '124', '1671', '6', '590', '3540', '0', '', '0', '2026-10-22 19:28:42', '1671', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','520-6,','1','1','0','0','590','3540','0','','0','0.00','0','0','0','0'); -- id=5467
UPDATE sellbilldetail SET  lastbuyprice = 590.00 , meanbuyprice = 590.00, lastbuyprice_withDiscount = 542.80, meanbuyprice_withDiscount = 542.80
        , lastbuyprice_withTax = 590, meanbuyprice_withTax = 590, lastbuyprice_withDiscountAndTax = 542.8
                where sellbilldetailid = 5467;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1671, '2026-10-22', 3540, 3540, 3540
                    , 3540, 3256.8, 3256.8, 3256.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 3540, 3540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3540, sellCostBuyPrice =sellCostBuyPrice+3540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3256.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3256.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3256.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3540, 3540, 3540
                    , 3540, 3256.8, 3256.8, 3256.8
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3540, 3540, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3540, sellCostBuyPrice =sellCostBuyPrice+3540
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3540, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3540
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3256.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3256.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3256.8
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3540
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3540
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '12', userid = '2', storedetaildate = '2026-10-22 19:28:42' WHERE storedetailid = '2683';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1671', '1', '6', '1', '1380', 'اضافة فاتورة مبيعات', 'sellbillController.php', '18', '12', '2', '2026-10-22 19:28:42','0','0'); -- id=17164
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 861;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('515.2','01836', '1380', '124', '1836', '3', '560', '1680', '0', '', '0', '2026-10-22 19:28:42', '1836', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','861-3,','1','1','0','0','560','1680','0','','0','0.00','0','0','0','0'); -- id=5468
UPDATE sellbilldetail SET  lastbuyprice = 560.00 , meanbuyprice = 560.00, lastbuyprice_withDiscount = 515.20, meanbuyprice_withDiscount = 515.20
        , lastbuyprice_withTax = 560, meanbuyprice_withTax = 560, lastbuyprice_withDiscountAndTax = 515.2
                where sellbilldetailid = 5468;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1836, '2026-10-22', 1680, 1680, 1680
                    , 1680, 1545.6, 1545.6, 1545.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1680, 1680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1680, 1680, 1680
                    , 1680, 1545.6, 1545.6, 1545.6
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1680, 1680, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1680, sellCostBuyPrice =sellCostBuyPrice+1680
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1680, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1680
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1545.6, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1545.6
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1545.6
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1680
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1680
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '2', storedetaildate = '2026-10-22 19:28:42' WHERE storedetailid = '2851';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1836', '1', '3', '1', '1380', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '3', '2', '2026-10-22 19:28:42','0','0'); -- id=17165
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8879951',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8871731','8220', '0', '2', 'اضافة فاتورة مبيعات', '1380', '8879951', '2026-10-22 19:28:42', '2',  'sellbillController.php','1','','0'); -- id=1691
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '8220', '8220', '2026-10-22', '2', '0', '0', '2026-10-22 19:28:42','اضافة فاتورة مبيعات رقم 1380','1','0',null,'0','1380','sellbillController.php?do=showDetail&sellbillid=1380'); -- id=4701
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4701', '419', '8220', '','0'); -- id=4835
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8879950.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4701', '143', '8220', '','0'); -- id=4703
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15542215', 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 ( '7562.4', '7562.4', '2026-10-22', '2', '0', '0', '2026-10-22 19:28:42','اضافة فاتورة مبيعات رقم 1380 - صرف البضاعة من المخزن','1','0',null,'0','1380','sellbillController.php?do=showDetail&sellbillid=1380'); -- id=4702
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4702', '402', '7562.4', '','0'); -- id=4836
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14376601.31', 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 ('4702', '382', '7562.4', '','0'); -- id=4704
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27820934.89', 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='4701,0,4702' where sellbillid=1380;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 8220, 8220, 8220
                    , 8220, 7562.4, 7562.4, 7562.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8220, 8220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8220, sellCostBuyPrice =sellCostBuyPrice+8220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7562.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7562.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7562.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 8220, 8220, 8220
                    , 8220, 7562.4, 7562.4, 7562.4
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,8220, 8220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8220, sellCostBuyPrice =sellCostBuyPrice+8220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7562.4, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7562.4
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+7562.4
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 8220, 8220, 8220
                    , 8220, 7562.4, 7562.4, 7562.4, 8220, 8220)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8220, netSellCostBuyPrice = netSellCostBuyPrice+8220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+8220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+8220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7562.4
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7562.4
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+7562.4
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+8220
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+8220;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada3549476e9 and sellbillId = 1380 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:28:42', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=18990
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:58:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:28:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierController.php', '2026-10-22 19:28:54', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierController.php?do=show'); -- id=18991
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:59:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:29:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2026-10-22 19:29:11', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyreport.php'); -- id=18992
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 15:59:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:29:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2026-10-22 19:29:15', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyreport.php'); -- id=18993
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:00:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:30:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:30:27', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=18994
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:00:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:30:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 19:30:55', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=show'); -- id=18995
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:01:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:31:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 19:31:09', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=show'); -- id=18996
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:01:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:31:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 19:31:23', '1', 'editshowstyle2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=editshowstyle2&operationnum=25'); -- id=18997
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:01:31";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:31:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storemovementController.php', '2026-10-22 19:31:31', '1', 'editshowstyle2', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storemovementController.php?do=editshowstyle2&operationnum=24'); -- id=18998
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:01:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:31:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:31:43', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=18999
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:01:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:31:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:31:52', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=19000
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:32:07', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=19001
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 19:32:12', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=19002
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:17";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storedetailController.php', '2026-10-22 19:32:17', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storedetailController.php'); -- id=19003
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:25";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2026-10-22 19:32:25', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyreport.php'); -- id=19004
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyreport.php', '2026-10-22 19:32:29', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyreport.php'); -- id=19005
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:02:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:32:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:32:49', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php'); -- id=19006
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:03:03";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:33:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:33:03', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=19007
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:03:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:33:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:33:20', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=19008
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:03:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:33:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:33:35', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=19009
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:04:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:34:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('storereportController.php', '2026-10-22 19:34:00', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/storereportController.php?do=show'); -- id=19010
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:04:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:34:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:34:15', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19011
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:04:35";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:34:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:34:35', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19012
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:05:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:35:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:35:47', '1', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=10'); -- id=19013
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:37:00', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19014

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada39babc3fa
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 19:37:00', '06ada39babc3fa', '1', '0.00', '0', '0', '1', '6290.00', '6290', '6290', '0', '1', '2026-10-22 19:37:00', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '11' ,'0','','','','','-1','0','0','0','0','0','6290','0','','0','0','6290','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1381
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1381', '0', '2026-10-22 19:37:00', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '6290', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 19:37:00','0','0','',''); -- id=1618
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1381', '207', '2381', '3', '470', '1410', '0', '', '0', '2026-10-22 19:37:00', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-3,','1','1','0','0','470','1410','0','','0','0.00','0','0','0','0'); -- id=5469
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5469;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1410, 1350, 1350
                    , 1350, 1350, 1350, 1350
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1350, 1350, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1410, sellCostBuyPrice =sellCostBuyPrice+1350
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1350, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1350
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1350, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1350
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1350
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1350
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1350
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '278', userid = '2', storedetaildate = '2026-10-22 19:37:00' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '3', '1', '1381', 'اضافة فاتورة مبيعات', 'sellbillController.php', '281', '278', '2', '2026-10-22 19:37:00','0','0'); -- id=17166
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+4 where id = 1156;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('600','01964', '1381', '28', '1964', '4', '620', '2480', '0', '', '0', '2026-10-22 19:37:00', '1964', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1156-4,','1','1','0','0','620','2480','0','','0','0.00','0','0','0','0'); -- id=5470
UPDATE sellbilldetail SET  lastbuyprice = 600.00 , meanbuyprice = 600.00, lastbuyprice_withDiscount = 600.00, meanbuyprice_withDiscount = 600.00
        , lastbuyprice_withTax = 600, meanbuyprice_withTax = 600, lastbuyprice_withDiscountAndTax = 600
                where sellbilldetailid = 5470;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1964, '2026-10-22', 2480, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2480, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2480, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2480, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '5', userid = '2', storedetaildate = '2026-10-22 19:37:00' WHERE storedetailid = '2981';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1964', '1', '4', '1', '1381', 'اضافة فاتورة مبيعات', 'sellbillController.php', '9', '5', '2', '2026-10-22 19:37:00','0','0'); -- id=17167
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('580','09733', '1381', '28', '949', '4', '600', '2400', '0', '', '0', '2026-10-22 19:37:00', '949', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','600','2400','0','','0','0.00','0','0','0','0'); -- id=5471
UPDATE sellbilldetail SET  lastbuyprice = 580.00 , meanbuyprice = 580.00, lastbuyprice_withDiscount = 580.00, meanbuyprice_withDiscount = 580.00
        , lastbuyprice_withTax = 580, meanbuyprice_withTax = 580, lastbuyprice_withDiscountAndTax = 580
                where sellbilldetailid = 5471;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (949, '2026-10-22', 2400, 2320, 2320
                    , 2320, 2320, 2320, 2320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0, 2320, 2320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+4
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2400, 2320, 2320
                    , 2320, 2320, 2320, 2320
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2320, 2320, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2400, sellCostBuyPrice =sellCostBuyPrice+2320
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2320, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2320
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2320, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2320
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2320
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2320
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2320
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '6', userid = '2', storedetaildate = '2026-10-22 19:37:00' WHERE storedetailid = '949';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('949', '1', '4', '1', '1381', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10', '6', '2', '2026-10-22 19:37:00','0','0'); -- id=17168
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8886241',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8879951','6290', '0', '2', 'اضافة فاتورة مبيعات', '1381', '8886241', '2026-10-22 19:37:00', '2',  'sellbillController.php','1','','0'); -- id=1692
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '6290', '6290', '2026-10-22', '2', '0', '0', '2026-10-22 19:37:00','اضافة فاتورة مبيعات رقم 1381','1','0',null,'0','1381','sellbillController.php?do=showDetail&sellbillid=1381'); -- id=4703
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4703', '419', '6290', '','0'); -- id=4837
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8886240.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4703', '143', '6290', '','0'); -- id=4705
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15548505', 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 ( '6070', '6070', '2026-10-22', '2', '0', '0', '2026-10-22 19:37:00','اضافة فاتورة مبيعات رقم 1381 - صرف البضاعة من المخزن','1','0',null,'0','1381','sellbillController.php?do=showDetail&sellbillid=1381'); -- id=4704
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4704', '402', '6070', '','0'); -- id=4838
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14382671.31', 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 ('4704', '382', '6070', '','0'); -- id=4706
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27814864.89', 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='4703,0,4704' where sellbillid=1381;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 6290, 6070, 6070
                    , 6070, 6070, 6070, 6070
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6070, 6070, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6290, sellCostBuyPrice =sellCostBuyPrice+6070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6070, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6070
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6070
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6070
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6070
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6290, 6070, 6070
                    , 6070, 6070, 6070, 6070
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,6070, 6070, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6290, sellCostBuyPrice =sellCostBuyPrice+6070
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+6070, sellCostMeanBuyPrice = sellCostMeanBuyPrice+6070
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+6070, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+6070
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+6070
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+6070
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+6070
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 6290, 6070, 6070
                    , 6070, 6070, 6070, 6070, 6070, 6070)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+6290, netSellCostBuyPrice = netSellCostBuyPrice+6070
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+6070
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+6070
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+6070
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+6070
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+6070
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+6070
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+6070;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada39babc3fa and sellbillId = 1381 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:00";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:00", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:37:00', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19015
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-22 19:37:23', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=19016
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 19:37:38', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=add'); -- id=19017
UPDATE storedetail SET  productquantity = '11', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1355', '1', '11', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0', '11', '1', '2026-10-22','0','0'); -- id=17169
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-22 19:37:40', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=19018
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:07:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:37:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:37:54', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19019
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:08:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:38:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:38:06', '1', 'delete', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=delete&id=10'); -- id=19020
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 10;
update productserial set del= 1 WHERE billid = 10
		and type =0 
		;
UPDATE buybill SET  buybillsysdate = '2026-10-22 19:38:06', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '10';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-09-30 16:03:16', 1, 1355, 0, 0
                    , 0, 11, 0, 0, 1, '2026-10-22 19:38:06')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-11, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 19:38:06' ; -- id=47
UPDATE buybilldetail SET  lastbuyprice = 0.00 , meanbuyprice = 0.00, lastbuyprice_withDiscount = 0.00, meanbuyprice_withDiscount = 0.00
        , lastbuyprice_withTax = 0.00, meanbuyprice_withTax = 0.00, lastbuyprice_withDiscountAndTax = 0.00
                where buybilldetailid = 42;
UPDATE product SET productName = 'قطن الونش /', productDescription = '', productCatId = '13', productBuyPrice = '0.00', productSellAllPrice = '320.00', productSellUnitPrice = '320.00', productSellHalfPrice = '320.00', productDate = '2026-09-30', conditions = '0', userId = '1', limitamount = '0', parcode = '07909',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '0',lastbuyprice_withDiscount = '0',meanbuyprice = '0.00',meanbuyprice_withDiscount = '0' , productbuypricereal = '0.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '6.67' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='0',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='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 = '1355';
UPDATE productunit SET proUnitBuyPrice  = 0 * productnumber WHERE productid = 1355;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1355';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1355', '1', '11', '1', '10', 'حذف فاتورة مشتريات', 'buyBillController.php', '11', '0', '1', '2026-10-22','0','0'); -- id=17170
UPDATE supplier SET  suppliercurrentDebt = '0',suppliercurrentDebtInCurrency= '-3150' , userid = '1', supplierdate = '2026-10-22 19:38: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', '0.00', '0.00', '1', 'حذف فاتورة مشتريات', '10', '0', '2026-10-22 19:38:06', '1', 'buyBillController.php', 'حذف فاتورة مشتريات', '0','', '0','1','1','0','1','-3150','0','-3150','0',''); -- id=911
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:08:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:38:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:38:06', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=sucess'); -- id=19021
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:08:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:38:08", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:38:08', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19022

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada3bac99f5b
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada3bac99f5b and sellbillId = 1382 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:08:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:38:08", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:38:08', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19023
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:08:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:38:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 19:38:08', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19024
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:12:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:42:28", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:42:28', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19025

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada3bf058c7d
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada3bf058c7d and sellbillId = 1383 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:12:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:42:29", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:42:29', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19026
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:28:06";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:58:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:58:06', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19027
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:28:08";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:58:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:58:08', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19028
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:28:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 19:58:48", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 19:58:48', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19029
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:01:34', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19030
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:01:46', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19031
BEGIN;
CALL supplierInUse(58,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('58', '542543.00', '20000', '1', 'ايصال دفع لمورد', '1', '522543', '2026-10-22 20:01:34', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','20000','1','0','0','0','187',''); -- id=912
UPDATE supplierdebtchange SET supplierid = '58', supplierdebtchangebefore = '542543.00', supplierdebtchangeamount = '20000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '522543', supplierdebtchangedate = '2026-10-22 20:01:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='20000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='542543',debtchangamountInSupplierCurrency='20000',debtchangafterInSupplierCurrency='522543', paySerialNo='187',tagids='' WHERE supplierdebtchangeid = '912';
UPDATE supplier SET  suppliercurrentDebt = '522543',suppliercurrentDebtInCurrency= '522543' , userid = '1', supplierdate = '2026-10-22 20:01:46'   WHERE supplierid = '58';
UPDATE supplier SET  inUse = 0 where supplierid = 58;
UPDATE save SET  savecurrentvalue = '-42521306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42501306.00','20000', '1', '1', 'ايصال دفع لمورد', '912', '-42521306', '2026-10-22 20:01:46', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1695
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '20000', '20000', '2026-10-22', '1', '0', '0', '2026-10-22 20:01:46','ايصال دفع لمورد ( زاي وان - مورد ) ','1','0','0','0','912','supplierReportsController.php?do=show&id=912'); -- id=4709
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4709', '477', '20000', '','0'); -- id=4843
UPDATE accountstree SET name = 'زاي وان - مورد', customName = 'زاي وان - مورد', customNameEn = 'زاي وان - مورد', nameEn = 'زاي وان - مورد', parent = '81', accountNature = '1', theValue = '17175', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '477';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4709', '383', '20000', '','0'); -- id=4711
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42521309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '58', supplierdebtchangebefore = '542543.00', supplierdebtchangeamount = '20000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '522543.00', supplierdebtchangedate = '2026-10-22 20:01:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4709',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='20000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='542543',debtchangamountInSupplierCurrency='20000',debtchangafterInSupplierCurrency='522543', paySerialNo='187',tagids='' WHERE supplierdebtchangeid = '912';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:01:46', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19032
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:01:48', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19033
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:01:48', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19034
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:31:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:01:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:01:49', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19035
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:24', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19036
BEGIN;
CALL supplierInUse(27,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('27', '305711.60', '30000', '1', 'ايصال دفع لمورد', '1', '275711.6', '2026-10-22 20:01:49', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','30000','1','0','0','0','188',''); -- id=913
UPDATE supplierdebtchange SET supplierid = '27', supplierdebtchangebefore = '305711.60', supplierdebtchangeamount = '30000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '275711.6', supplierdebtchangedate = '2026-10-22 20:01:49', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='275711.6', paySerialNo='188',tagids='' WHERE supplierdebtchangeid = '913';
UPDATE supplier SET  suppliercurrentDebt = '275711.6',suppliercurrentDebtInCurrency= '275711.6' , userid = '1', supplierdate = '2026-10-22 20:02:24'   WHERE supplierid = '27';
UPDATE supplier SET  inUse = 0 where supplierid = 27;
UPDATE save SET  savecurrentvalue = '-42551306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42521306.00','30000', '1', '1', 'ايصال دفع لمورد', '913', '-42551306', '2026-10-22 20:02:24', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1696
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-22', '1', '0', '0', '2026-10-22 20:02:24','ايصال دفع لمورد ( مصنع الجمل - مورد ) ','1','0','0','0','913','supplierReportsController.php?do=show&id=913'); -- id=4710
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4710', '446', '30000', '','0'); -- id=4844
UPDATE accountstree SET name = 'مصنع الجمل - مورد', customName = 'مصنع الجمل - مورد', customNameEn = 'مصنع الجمل - مورد', nameEn = 'مصنع الجمل - مورد', parent = '81', accountNature = '1', theValue = '-30000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '446';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4710', '383', '30000', '','0'); -- id=4712
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42551309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '27', supplierdebtchangebefore = '305711.60', supplierdebtchangeamount = '30000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '275711.60', supplierdebtchangedate = '2026-10-22 20:01:49', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4710',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='546030',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='275711.6', paySerialNo='188',tagids='' WHERE supplierdebtchangeid = '913';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:24', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19037
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:26', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19038
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:02:26', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19039
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:26";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:26', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19040
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:39', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19041
BEGIN;
CALL supplierInUse(65,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('65', '653270.00', '50000', '1', 'ايصال دفع لمورد', '1', '603270', '2026-10-22 20:02:26', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','189',''); -- id=914
UPDATE supplierdebtchange SET supplierid = '65', supplierdebtchangebefore = '653270.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '603270', supplierdebtchangedate = '2026-10-22 20:02:26', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='653270',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='603270', paySerialNo='189',tagids='' WHERE supplierdebtchangeid = '914';
UPDATE supplier SET  suppliercurrentDebt = '603270',suppliercurrentDebtInCurrency= '603270' , userid = '1', supplierdate = '2026-10-22 20:02:39'   WHERE supplierid = '65';
UPDATE supplier SET  inUse = 0 where supplierid = 65;
UPDATE save SET  savecurrentvalue = '-42601306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42551306.00','50000', '1', '1', 'ايصال دفع لمورد', '914', '-42601306', '2026-10-22 20:02:39', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1697
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-22', '1', '0', '0', '2026-10-22 20:02:39','ايصال دفع لمورد ( توب سيكرت - مورد ) ','1','0','0','0','914','supplierReportsController.php?do=show&id=914'); -- id=4711
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4711', '484', '50000', '','0'); -- id=4845
UPDATE accountstree SET name = 'توب سيكرت - مورد', customName = 'توب سيكرت - مورد', customNameEn = 'توب سيكرت - مورد', nameEn = 'توب سيكرت - مورد', parent = '81', accountNature = '1', theValue = '-271630', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '484';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4711', '383', '50000', '','0'); -- id=4713
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42601309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '65', supplierdebtchangebefore = '653270.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '603270.00', supplierdebtchangedate = '2026-10-22 20:02:26', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4711',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='653270',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='603270', paySerialNo='189',tagids='' WHERE supplierdebtchangeid = '914';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:39', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19042
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:40', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19043
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:02:41', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19044
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:44', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19045
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:57', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19046
BEGIN;
CALL supplierInUse(124,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('124', '235000.00', '50000', '1', 'ايصال دفع لمورد', '1', '185000', '2026-10-22 20:02:44', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','190',''); -- id=915
UPDATE supplierdebtchange SET supplierid = '124', supplierdebtchangebefore = '235000.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '185000', supplierdebtchangedate = '2026-10-22 20:02:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='235000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='185000', paySerialNo='190',tagids='' WHERE supplierdebtchangeid = '915';
UPDATE supplier SET  suppliercurrentDebt = '185000',suppliercurrentDebtInCurrency= '185000' , userid = '1', supplierdate = '2026-10-22 20:02:57'   WHERE supplierid = '124';
UPDATE supplier SET  inUse = 0 where supplierid = 124;
UPDATE save SET  savecurrentvalue = '-42651306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42601306.00','50000', '1', '1', 'ايصال دفع لمورد', '915', '-42651306', '2026-10-22 20:02:57', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1698
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-22', '1', '0', '0', '2026-10-22 20:02:57','ايصال دفع لمورد ( الاسد ) ','1','0','0','0','915','supplierReportsController.php?do=show&id=915'); -- id=4712
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4712', '607', '50000', '','0'); -- id=4846
UPDATE accountstree SET name = 'الاسد', customName = 'الاسد', customNameEn = 'الاسد', nameEn = 'الاسد', parent = '81', accountNature = '1', theValue = '185000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 12:23:57' WHERE id = '607';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4712', '383', '50000', '','0'); -- id=4714
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42651309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '124', supplierdebtchangebefore = '235000.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '185000.00', supplierdebtchangedate = '2026-10-22 20:02:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4712',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='235000',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='185000', paySerialNo='190',tagids='' WHERE supplierdebtchangeid = '915';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:57";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:57', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19047
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:02:58', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19048
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:32:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:02:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:02:59', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19049
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:28', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19050
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:41', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19051
BEGIN;
CALL supplierInUse(148,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('148', '56463.20', '100000', '1', 'ايصال دفع لمورد', '1', '-43536.8', '2026-10-22 20:03:28', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','100000','1','0','0','0','191',''); -- id=916
UPDATE supplierdebtchange SET supplierid = '148', supplierdebtchangebefore = '56463.20', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-43536.8', supplierdebtchangedate = '2026-10-22 20:03:28', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='56463.2',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-43536.8', paySerialNo='191',tagids='' WHERE supplierdebtchangeid = '916';
UPDATE supplier SET  suppliercurrentDebt = '-43536.8',suppliercurrentDebtInCurrency= '-43536.8' , userid = '1', supplierdate = '2026-10-22 20:03:41'   WHERE supplierid = '148';
UPDATE supplier SET  inUse = 0 where supplierid = 148;
UPDATE save SET  savecurrentvalue = '-42751306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42651306.00','100000', '1', '1', 'ايصال دفع لمورد', '916', '-42751306', '2026-10-22 20:03:41', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1699
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-22', '1', '0', '0', '2026-10-22 20:03:41','ايصال دفع لمورد ( دونجا - مورد ) ','1','0','0','0','916','supplierReportsController.php?do=show&id=916'); -- id=4713
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4713', '631', '100000', '','0'); -- id=4847
UPDATE accountstree SET name = 'دونجا - مورد', customName = 'دونجا - مورد', customNameEn = 'دونجا - مورد', nameEn = 'دونجا - مورد', parent = '81', accountNature = '1', theValue = '-43536.8', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:35:34' WHERE id = '631';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4713', '383', '100000', '','0'); -- id=4715
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42751309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '148', supplierdebtchangebefore = '56463.20', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-43536.80', supplierdebtchangedate = '2026-10-22 20:03:28', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4713',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='56463.2',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='-43536.8', paySerialNo='191',tagids='' WHERE supplierdebtchangeid = '916';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:42', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19052
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:43', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19053
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:43";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:03:43', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19054
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:44', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19055
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:56', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19056
BEGIN;
CALL supplierInUse(207,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('207', '132300.00', '100000', '1', 'ايصال دفع لمورد', '1', '32300', '2026-10-22 20:03:44', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','100000','1','0','0','0','192',''); -- id=917
UPDATE supplierdebtchange SET supplierid = '207', supplierdebtchangebefore = '132300.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '32300', supplierdebtchangedate = '2026-10-22 20:03:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='132300',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='32300', paySerialNo='192',tagids='' WHERE supplierdebtchangeid = '917';
UPDATE supplier SET  suppliercurrentDebt = '32300',suppliercurrentDebtInCurrency= '32300' , userid = '1', supplierdate = '2026-10-22 20:03:56'   WHERE supplierid = '207';
UPDATE supplier SET  inUse = 0 where supplierid = 207;
UPDATE save SET  savecurrentvalue = '-42851306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42751306.00','100000', '1', '1', 'ايصال دفع لمورد', '917', '-42851306', '2026-10-22 20:03:56', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1700
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-22', '1', '0', '0', '2026-10-22 20:03:56','ايصال دفع لمورد ( احمد شحاتة ) ','1','0','0','0','917','supplierReportsController.php?do=show&id=917'); -- id=4714
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4714', '694', '100000', '','0'); -- id=4848
UPDATE accountstree SET name = 'احمد شحاتة', customName = 'احمد شحاتة', customNameEn = 'احمد شحاتة', nameEn = 'احمد شحاتة', parent = '81', accountNature = '1', theValue = '32300', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '7', del = '0', sysdate = '2026-10-22 13:57:06' WHERE id = '694';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4714', '383', '100000', '','0'); -- id=4716
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42851309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '207', supplierdebtchangebefore = '132300.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '32300.00', supplierdebtchangedate = '2026-10-22 20:03:44', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4714',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='132300',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='32300', paySerialNo='192',tagids='' WHERE supplierdebtchangeid = '917';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:56', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19057
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:03:58', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19058
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:33:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:03:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:03:58', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19059
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:01";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:01', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19060
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:12', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19061
BEGIN;
CALL supplierInUse(5,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('5', '656722.00', '50000', '1', 'ايصال دفع لمورد', '1', '606722', '2026-10-22 20:04:01', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','50000','1','0','0','0','193',''); -- id=918
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '656722.00', supplierdebtchangeamount = '50000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '606722', supplierdebtchangedate = '2026-10-22 20:04:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='656722',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='606722', paySerialNo='193',tagids='' WHERE supplierdebtchangeid = '918';
UPDATE supplier SET  suppliercurrentDebt = '606722',suppliercurrentDebtInCurrency= '606722' , userid = '1', supplierdate = '2026-10-22 20:04:12'   WHERE supplierid = '5';
UPDATE supplier SET  inUse = 0 where supplierid = 5;
UPDATE save SET  savecurrentvalue = '-42901306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42851306.00','50000', '1', '1', 'ايصال دفع لمورد', '918', '-42901306', '2026-10-22 20:04:12', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1701
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '50000', '50000', '2026-10-22', '1', '0', '0', '2026-10-22 20:04:12','ايصال دفع لمورد ( الونش - مورد ) ','1','0','0','0','918','supplierReportsController.php?do=show&id=918'); -- id=4715
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4715', '424', '50000', '','0'); -- id=4849
UPDATE accountstree SET name = 'الونش - مورد', customName = 'الونش - مورد', customNameEn = 'الونش - مورد', nameEn = 'الونش - مورد', parent = '81', accountNature = '1', theValue = '60640', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '424';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4715', '383', '50000', '','0'); -- id=4717
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42901309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '5', supplierdebtchangebefore = '656722.00', supplierdebtchangeamount = '50000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '606722.00', supplierdebtchangedate = '2026-10-22 20:04:01', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4715',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='50000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='656722',debtchangamountInSupplierCurrency='50000',debtchangafterInSupplierCurrency='606722', paySerialNo='193',tagids='' WHERE supplierdebtchangeid = '918';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:12', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19062
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:14', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19063
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:04:14', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19064
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:20', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19065
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:34', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19066
BEGIN;
CALL supplierInUse(137,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('137', '194668.00', '30000', '1', 'ايصال دفع لمورد', '1', '164668', '2026-10-22 20:04:20', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','30000','1','0','0','0','194',''); -- id=919
UPDATE supplierdebtchange SET supplierid = '137', supplierdebtchangebefore = '194668.00', supplierdebtchangeamount = '30000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '164668', supplierdebtchangedate = '2026-10-22 20:04:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='194668',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='164668', paySerialNo='194',tagids='' WHERE supplierdebtchangeid = '919';
UPDATE supplier SET  suppliercurrentDebt = '164668',suppliercurrentDebtInCurrency= '164668' , userid = '1', supplierdate = '2026-10-22 20:04:34'   WHERE supplierid = '137';
UPDATE supplier SET  inUse = 0 where supplierid = 137;
UPDATE save SET  savecurrentvalue = '-42931306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42901306.00','30000', '1', '1', 'ايصال دفع لمورد', '919', '-42931306', '2026-10-22 20:04:34', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1702
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-22', '1', '0', '0', '2026-10-22 20:04:34','ايصال دفع لمورد ( برو ) ','1','0','0','0','919','supplierReportsController.php?do=show&id=919'); -- id=4716
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4716', '620', '30000', '','0'); -- id=4850
UPDATE accountstree SET name = 'برو', customName = 'برو', customNameEn = 'برو', nameEn = 'برو', parent = '81', accountNature = '1', theValue = '164668', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:09:52' WHERE id = '620';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4716', '383', '30000', '','0'); -- id=4718
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42931309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '137', supplierdebtchangebefore = '194668.00', supplierdebtchangeamount = '30000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '164668.00', supplierdebtchangedate = '2026-10-22 20:04:20', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4716',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='194668',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='164668', paySerialNo='194',tagids='' WHERE supplierdebtchangeid = '919';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:34', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19067
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:36', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19068
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:04:36', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19069
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:38', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19070
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:48";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:48', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19071
BEGIN;
CALL supplierInUse(24,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('24', '75585.00', '30000', '1', 'ايصال دفع لمورد', '1', '45585', '2026-10-22 20:04:38', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','30000','1','0','0','0','195',''); -- id=920
UPDATE supplierdebtchange SET supplierid = '24', supplierdebtchangebefore = '75585.00', supplierdebtchangeamount = '30000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '45585', supplierdebtchangedate = '2026-10-22 20:04:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='75585',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='45585', paySerialNo='195',tagids='' WHERE supplierdebtchangeid = '920';
UPDATE supplier SET  suppliercurrentDebt = '45585',suppliercurrentDebtInCurrency= '45585' , userid = '1', supplierdate = '2026-10-22 20:04:48'   WHERE supplierid = '24';
UPDATE supplier SET  inUse = 0 where supplierid = 24;
UPDATE save SET  savecurrentvalue = '-42961306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42931306.00','30000', '1', '1', 'ايصال دفع لمورد', '920', '-42961306', '2026-10-22 20:04:49', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1703
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '30000', '30000', '2026-10-22', '1', '0', '0', '2026-10-22 20:04:49','ايصال دفع لمورد ( مارادونا - مورد ) ','1','0','0','0','920','supplierReportsController.php?do=show&id=920'); -- id=4717
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4717', '443', '30000', '','0'); -- id=4851
UPDATE accountstree SET name = 'مارادونا - مورد', customName = 'مارادونا - مورد', customNameEn = 'مارادونا - مورد', nameEn = 'مارادونا - مورد', parent = '81', accountNature = '1', theValue = '-269275', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '443';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4717', '383', '30000', '','0'); -- id=4719
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-42961309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '24', supplierdebtchangebefore = '75585.00', supplierdebtchangeamount = '30000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '45585.00', supplierdebtchangedate = '2026-10-22 20:04:38', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4717',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='30000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='75585',debtchangamountInSupplierCurrency='30000',debtchangafterInSupplierCurrency='45585', paySerialNo='195',tagids='' WHERE supplierdebtchangeid = '920';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:49', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19072
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:50', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19073
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:04:51', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19074
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:34:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:04:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:04:55', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19075
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:16', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19076
BEGIN;
CALL supplierInUse(82,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('82', '956762.00', '200000', '1', 'ايصال دفع لمورد', '1', '756762', '2026-10-22 20:04:55', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','200000','1','0','0','0','196',''); -- id=921
UPDATE supplierdebtchange SET supplierid = '82', supplierdebtchangebefore = '956762.00', supplierdebtchangeamount = '200000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '756762', supplierdebtchangedate = '2026-10-22 20:04:55', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='956762',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='756762', paySerialNo='196',tagids='' WHERE supplierdebtchangeid = '921';
UPDATE supplier SET  suppliercurrentDebt = '756762',suppliercurrentDebtInCurrency= '756762' , userid = '1', supplierdate = '2026-10-22 20:05:16'   WHERE supplierid = '82';
UPDATE supplier SET  inUse = 0 where supplierid = 82;
UPDATE save SET  savecurrentvalue = '-43161306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-42961306.00','200000', '1', '1', 'ايصال دفع لمورد', '921', '-43161306', '2026-10-22 20:05:16', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1704
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200000', '200000', '2026-10-22', '1', '0', '0', '2026-10-22 20:05:16','ايصال دفع لمورد ( اوت فيت ) ','1','0','0','0','921','supplierReportsController.php?do=show&id=921'); -- id=4718
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4718', '560', '200000', '','0'); -- id=4852
UPDATE accountstree SET name = 'اوت فيت', customName = 'اوت فيت', customNameEn = 'اوت فيت', nameEn = 'اوت فيت', parent = '81', accountNature = '1', theValue = '756762', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-03 18:26:01' WHERE id = '560';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4718', '383', '200000', '','0'); -- id=4720
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-43161309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '82', supplierdebtchangebefore = '956762.00', supplierdebtchangeamount = '200000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '756762.00', supplierdebtchangedate = '2026-10-22 20:04:55', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4718',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='956762',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='756762', paySerialNo='196',tagids='' WHERE supplierdebtchangeid = '921';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:16";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:16', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19077
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:18', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19078
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:18";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:05:18', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19079
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:39";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:39', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19080
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:52";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:52', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19081
BEGIN;
CALL supplierInUse(161,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('161', '449619.00', '200000', '1', 'ايصال دفع لمورد', '1', '249619', '2026-10-22 20:05:39', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','200000','1','0','0','0','197',''); -- id=922
UPDATE supplierdebtchange SET supplierid = '161', supplierdebtchangebefore = '449619.00', supplierdebtchangeamount = '200000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '249619', supplierdebtchangedate = '2026-10-22 20:05:39', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='449619',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='249619', paySerialNo='197',tagids='' WHERE supplierdebtchangeid = '922';
UPDATE supplier SET  suppliercurrentDebt = '249619',suppliercurrentDebtInCurrency= '249619' , userid = '1', supplierdate = '2026-10-22 20:05:52'   WHERE supplierid = '161';
UPDATE supplier SET  inUse = 0 where supplierid = 161;
UPDATE save SET  savecurrentvalue = '-43361306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-43161306.00','200000', '1', '1', 'ايصال دفع لمورد', '922', '-43361306', '2026-10-22 20:05:52', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1705
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200000', '200000', '2026-10-22', '1', '0', '0', '2026-10-22 20:05:52','ايصال دفع لمورد ( الالماني ) ','1','0','0','0','922','supplierReportsController.php?do=show&id=922'); -- id=4719
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4719', '644', '200000', '','0'); -- id=4853
UPDATE accountstree SET name = 'الالماني', customName = 'الالماني', customNameEn = 'الالماني', nameEn = 'الالماني', parent = '81', accountNature = '1', theValue = '249619', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 18:57:07' WHERE id = '644';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4719', '383', '200000', '','0'); -- id=4721
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-43361309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '161', supplierdebtchangebefore = '449619.00', supplierdebtchangeamount = '200000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '249619.00', supplierdebtchangedate = '2026-10-22 20:05:39', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4719',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='449619',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='249619', paySerialNo='197',tagids='' WHERE supplierdebtchangeid = '922';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:53";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:53', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19082
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:54', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19083
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:54";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:05:54', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19084
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:35:59";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:05:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:05:59', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19085
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:11', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19086
BEGIN;
CALL supplierInUse(162,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('162', '458185.00', '300000', '1', 'ايصال دفع لمورد', '1', '158185', '2026-10-22 20:05:59', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','300000','1','0','0','0','198',''); -- id=923
UPDATE supplierdebtchange SET supplierid = '162', supplierdebtchangebefore = '458185.00', supplierdebtchangeamount = '300000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '158185', supplierdebtchangedate = '2026-10-22 20:05:59', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='458185',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='158185', paySerialNo='198',tagids='' WHERE supplierdebtchangeid = '923';
UPDATE supplier SET  suppliercurrentDebt = '158185',suppliercurrentDebtInCurrency= '158185' , userid = '1', supplierdate = '2026-10-22 20:06:11'   WHERE supplierid = '162';
UPDATE supplier SET  inUse = 0 where supplierid = 162;
UPDATE save SET  savecurrentvalue = '-43661306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-43361306.00','300000', '1', '1', 'ايصال دفع لمورد', '923', '-43661306', '2026-10-22 20:06:11', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1706
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '300000', '300000', '2026-10-22', '1', '0', '0', '2026-10-22 20:06:11','ايصال دفع لمورد ( مصطفي زورو ) ','1','0','0','0','923','supplierReportsController.php?do=show&id=923'); -- id=4720
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4720', '645', '300000', '','0'); -- id=4854
UPDATE accountstree SET name = 'مصطفي زورو', customName = 'مصطفي زورو', customNameEn = 'مصطفي زورو', nameEn = 'مصطفي زورو', parent = '81', accountNature = '1', theValue = '158185', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-12 20:29:34' WHERE id = '645';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4720', '383', '300000', '','0'); -- id=4722
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-43661309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '162', supplierdebtchangebefore = '458185.00', supplierdebtchangeamount = '300000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '158185.00', supplierdebtchangedate = '2026-10-22 20:05:59', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4720',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='300000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='458185',debtchangamountInSupplierCurrency='300000',debtchangafterInSupplierCurrency='158185', paySerialNo='198',tagids='' WHERE supplierdebtchangeid = '923';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:11', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19087
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:13', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19088
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:06:13', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19089
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:15', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19090
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:28', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19091
BEGIN;
CALL supplierInUse(106,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('106', '-992400.00', '200000', '1', 'ايصال دفع لمورد', '1', '-1192400', '2026-10-22 20:06:15', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','200000','1','0','0','0','199',''); -- id=924
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '-992400.00', supplierdebtchangeamount = '200000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1192400', supplierdebtchangedate = '2026-10-22 20:06:15', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='-992400',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='-1192400', paySerialNo='199',tagids='' WHERE supplierdebtchangeid = '924';
UPDATE supplier SET  suppliercurrentDebt = '-1192400',suppliercurrentDebtInCurrency= '-1192400' , userid = '1', supplierdate = '2026-10-22 20:06:28'   WHERE supplierid = '106';
UPDATE supplier SET  inUse = 0 where supplierid = 106;
UPDATE save SET  savecurrentvalue = '-43861306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-43661306.00','200000', '1', '1', 'ايصال دفع لمورد', '924', '-43861306', '2026-10-22 20:06:28', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1707
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '200000', '200000', '2026-10-22', '1', '0', '0', '2026-10-22 20:06:28','ايصال دفع لمورد ( تمبو ) ','1','0','0','0','924','supplierReportsController.php?do=show&id=924'); -- id=4721
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4721', '589', '200000', '','0'); -- id=4855
UPDATE accountstree SET name = 'تمبو', customName = 'تمبو', customNameEn = 'تمبو', nameEn = 'تمبو', parent = '81', accountNature = '1', theValue = '-1192400', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-07 09:33:15' WHERE id = '589';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4721', '383', '200000', '','0'); -- id=4723
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-43861309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '106', supplierdebtchangebefore = '-992400.00', supplierdebtchangeamount = '200000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '-1192400.00', supplierdebtchangedate = '2026-10-22 20:06:15', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4721',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='200000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='-992400',debtchangamountInSupplierCurrency='200000',debtchangafterInSupplierCurrency='-1192400', paySerialNo='199',tagids='' WHERE supplierdebtchangeid = '924';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:28', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19092
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:30', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19093
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:06:30', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19094
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:34";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:34', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php'); -- id=19095
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:49', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=add'); -- id=19096
BEGIN;
CALL supplierInUse(40,@supplierdebt,@suppliername,@dailyentryid,@treeIdis);
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('40', '472490.00', '100000', '1', 'ايصال دفع لمورد', '1', '372490', '2026-10-22 20:06:34', '1', 'supplierPayedDeptController.php', '', '0','1', '-1','1','1','100000','1','0','0','0','200',''); -- id=925
UPDATE supplierdebtchange SET supplierid = '40', supplierdebtchangebefore = '472490.00', supplierdebtchangeamount = '100000', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '372490', supplierdebtchangedate = '2026-10-22 20:06:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '0',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='472490',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='372490', paySerialNo='200',tagids='' WHERE supplierdebtchangeid = '925';
UPDATE supplier SET  suppliercurrentDebt = '372490',suppliercurrentDebtInCurrency= '372490' , userid = '1', supplierdate = '2026-10-22 20:06:49'   WHERE supplierid = '40';
UPDATE supplier SET  inUse = 0 where supplierid = 40;
UPDATE save SET  savecurrentvalue = '-43961306',  userid = '1' WHERE saveid = '1';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('-43861306.00','100000', '1', '1', 'ايصال دفع لمورد', '925', '-43961306', '2026-10-22 20:06:49', '1',  'supplierPayedDeptController.php','0','','0'); -- id=1708
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '100000', '100000', '2026-10-22', '1', '0', '0', '2026-10-22 20:06:49','ايصال دفع لمورد ( كوين - مورد ) ','1','0','0','0','925','supplierReportsController.php?do=show&id=925'); -- id=4722
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4722', '459', '100000', '','0'); -- id=4856
UPDATE accountstree SET name = 'كوين - مورد', customName = 'كوين - مورد', customNameEn = 'كوين - مورد', nameEn = 'كوين - مورد', parent = '81', accountNature = '1', theValue = '750', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '459';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4722', '383', '100000', '','0'); -- id=4724
UPDATE accountstree SET name = 'الخزنة الرئيسية', customName = 'الخزنة الرئيسية', customNameEn = 'الخزنة الرئيسية', nameEn = 'الخزنة الرئيسية', parent = '40', accountNature = '0', theValue = '-43961309.8', theOrder = '0', layingOrder = '12010200002', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Bank and Cash ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:28' WHERE id = '383';
UPDATE supplierdebtchange SET supplierid = '40', supplierdebtchangebefore = '472490.00', supplierdebtchangeamount = '100000.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '1', supplierdebtchangeafter = '372490.00', supplierdebtchangedate = '2026-10-22 20:06:34', userid = '1', tablename = 'supplierPayedDeptController.php', comment = '', dailyentryid = '4722',saveid = '1',currencyId='1',conversionFactor='1',payedInCurrency='100000',saveConversionFactor='1',debtchangbeforeInSupplierCurrency='472490',debtchangamountInSupplierCurrency='100000',debtchangafterInSupplierCurrency='372490', paySerialNo='200',tagids='' WHERE supplierdebtchangeid = '925';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:49";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:49', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=sucess'); -- id=19097
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierPayedDeptController.php', '2026-10-22 20:06:51', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierPayedDeptController.php?do=show'); -- id=19098
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:51";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('supplierReportsController.php', '2026-10-22 20:06:51', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/supplierReportsController.php'); -- id=19099
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:36:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:06:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:06:55', '1', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19100
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:37:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:07:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:07:22', '1', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19101
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:38:27";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:08:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:08:27', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19102
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:38:30";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:08:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:08:30', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19103
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:39:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:09:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:09:13', '1', 'editsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=1299'); -- id=19104
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:39:20";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:09:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:09:20', '1', 'editsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=1302'); -- id=19105
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:39:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:09:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:09:44', '1', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=19106
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 1299;
UPDATE sellbill SET  sellbillsysdate = '2026-10-22 20:09:44', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '1299';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-57 where id = 7027;
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5207;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0,57,0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27645, sellCostBuyPrice =sellCostBuyPrice-26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26220
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-57
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-27645, sellCostBuyPrice =sellCostBuyPrice-26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-26220
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '57', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '57', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '57', '1', '2026-10-22 13:14:20','0','0'); -- id=17174
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-21 where id = 7026;
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5208;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2379, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0,21,0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10395, sellCostBuyPrice =sellCostBuyPrice-9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9870
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-21
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-10395, sellCostBuyPrice =sellCostBuyPrice-9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice-9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-9870
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2379', '1', '21', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '24', '45', '1', '2026-10-22 13:14:20','0','0'); -- id=17175
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-21 where id = 7028;
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5209;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0,21,0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9450, sellCostBuyPrice =sellCostBuyPrice-8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8925
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-21
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-9450, sellCostBuyPrice =sellCostBuyPrice-8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice-8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-8925
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '46', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '21', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '25', '46', '1', '2026-10-22 13:14:20','0','0'); -- id=17176
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-48 where id = 7031;
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5210;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0,48,0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21600, sellCostBuyPrice =sellCostBuyPrice-20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20640
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-48
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21600, sellCostBuyPrice =sellCostBuyPrice-20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice-20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-20640
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '219', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '48', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '171', '219', '1', '2026-10-22 13:14:20','0','0'); -- id=17177
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-27 where id = 7032;
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5211;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0,27,0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12690, sellCostBuyPrice =sellCostBuyPrice-12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-12150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-27
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-12690, sellCostBuyPrice =sellCostBuyPrice-12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice-12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-12150
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '302', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '27', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '275', '302', '1', '2026-10-22 13:14:20','0','0'); -- id=17178
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 7072;
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5212;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2402, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3870, sellCostBuyPrice =sellCostBuyPrice-3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3870
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3870, sellCostBuyPrice =sellCostBuyPrice-3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3870
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '9', '0', '1299', 'تعديل فاتورة مبيعات', 'sellbillController.php', '0', '9', '1', '2026-10-22 13:14:20','0','0'); -- id=17179
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','1299', '0', '2026-10-22 13:14:20', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '85650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:14:20','0','0','',''); -- id=1621
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8805781',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8891431','85650', '1', '2', 'تعديل فاتورة مبيعات', '1299', '8805781', '2026-10-22 20:09:44', '1',  'sellbillController.php','1','','0'); -- id=1709
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85650, sellCostBuyPrice =sellCostBuyPrice-81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81675
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0, 81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-85650, sellCostBuyPrice =sellCostBuyPrice-81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice-81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-81675
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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, 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288, 81675, 81675)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-85650, netSellCostBuyPrice = netSellCostBuyPrice-81675
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-81675
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-81675
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-81288
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-81288
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-81288
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-81675
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-81675;

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


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

COMMIT;
BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:14:20', '06ad9de680ed7b', '40', '73920.00', '159570', '0', '1', '85650', '85650', '0', '85650', '1', '2026-10-22 13:14:20', '', '1', '0', 'الطوخي - عميل', '2', '1', '3', '0', 'الطوخي - عميل', '183', '1299', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=1384
UPDATE client SET  clientdebt = '159570', userid = '1' WHERE clientid = '40';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','73920.00','85650','0','اضافة فاتورة مبيعات (معدله)','1384', '159570', '2026-10-22 20:09:44', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '85650', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:14:20','0','0','',''); -- id=1622
UPDATE client SET  inUse = 0 where clientid = 40;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+57 where id = 7027;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('460','01921', '1384', '153', '1921', '57.00', '485', '27645', '0', '', '0', '2026-10-22 20:09:44', '1921', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7027-57,','1','1','0','0','485','27645','0','','0','0.00','0','0','0','0'); -- id=5475
UPDATE sellbilldetail SET  lastbuyprice = 460.00 , meanbuyprice = 460.00, lastbuyprice_withDiscount = 460.00, meanbuyprice_withDiscount = 460.00
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 460
                where sellbilldetailid = 5475;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1921, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 57, 0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27645, sellCostBuyPrice =sellCostBuyPrice+26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+57
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 27645, 26220, 26220
                    , 26220, 26220, 26220, 26220
                    , 0, 0, 0, 0
                    , 0, 0, 0, 26220, 26220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+27645, sellCostBuyPrice =sellCostBuyPrice+26220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+26220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+26220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+26220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+26220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+26220
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+26220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+26220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '2938';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1921', '1', '57', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '57', '0', '1', '2026-10-22 20:09:44','0','0'); -- id=17180
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7026;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('470','02379', '1384', '153', '2379', '21.00', '495', '10395', '0', '', '0', '2026-10-22 20:09:44', '2379', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7026-21,','1','1','0','0','495','10395','0','','0','0.00','0','0','0','0'); -- id=5476
UPDATE sellbilldetail SET  lastbuyprice = 470.00 , meanbuyprice = 470.00, lastbuyprice_withDiscount = 470.00, meanbuyprice_withDiscount = 470.00
        , lastbuyprice_withTax = 470, meanbuyprice_withTax = 470, lastbuyprice_withDiscountAndTax = 470
                where sellbilldetailid = 5476;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2379, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 10395, 9870, 9870
                    , 9870, 9870, 9870, 9870
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9870, 9870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+10395, sellCostBuyPrice =sellCostBuyPrice+9870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+9870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+9870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+9870, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+9870
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+9870
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+9870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+9870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3773';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2379', '1', '21', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '45', '24', '1', '2026-10-22 20:09:44','0','0'); -- id=17181
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+21 where id = 7028;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('425','01919', '1384', '153', '1919', '21.00', '450', '9450', '0', '', '0', '2026-10-22 20:09:44', '1919', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7028-21,','1','1','0','0','450','9450','0','','0','0.00','0','0','0','0'); -- id=5477
UPDATE sellbilldetail SET  lastbuyprice = 425.00 , meanbuyprice = 425.00, lastbuyprice_withDiscount = 425.00, meanbuyprice_withDiscount = 425.00
        , lastbuyprice_withTax = 425, meanbuyprice_withTax = 425, lastbuyprice_withDiscountAndTax = 425
                where sellbilldetailid = 5477;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1919, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0, 21, 0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+21
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 9450, 8925, 8925
                    , 8925, 8925, 8925, 8925
                    , 0, 0, 0, 0
                    , 0, 0, 0, 8925, 8925, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+9450, sellCostBuyPrice =sellCostBuyPrice+8925
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+8925, sellCostMeanBuyPrice = sellCostMeanBuyPrice+8925
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+8925, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+8925
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+8925
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+8925
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+8925
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '25', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '2936';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1919', '1', '21', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '46', '25', '1', '2026-10-22 20:09:44','0','0'); -- id=17182
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+48 where id = 7031;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('430','02380', '1384', '207', '2380', '48.00', '450', '21600', '0', '', '0', '2026-10-22 20:09:44', '2380', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7031-48,','1','1','0','0','450','21600','0','','0','0.00','0','0','0','0'); -- id=5478
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 430.00, meanbuyprice_withDiscount = 430.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 430
                where sellbilldetailid = 5478;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2380, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 48, 0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21600, sellCostBuyPrice =sellCostBuyPrice+20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+48
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 21600, 20640, 20640
                    , 20640, 20640, 20640, 20640
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20640, 20640, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21600, sellCostBuyPrice =sellCostBuyPrice+20640
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+20640, sellCostMeanBuyPrice = sellCostMeanBuyPrice+20640
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+20640, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+20640
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+20640
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+20640
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+20640
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '171', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3774';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2380', '1', '48', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '219', '171', '1', '2026-10-22 20:09:44','0','0'); -- id=17183
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+27 where id = 7032;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('450','02381', '1384', '207', '2381', '27.00', '470', '12690', '0', '', '0', '2026-10-22 20:09:44', '2381', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7032-27,','1','1','0','0','470','12690','0','','0','0.00','0','0','0','0'); -- id=5479
UPDATE sellbilldetail SET  lastbuyprice = 450.00 , meanbuyprice = 450.00, lastbuyprice_withDiscount = 450.00, meanbuyprice_withDiscount = 450.00
        , lastbuyprice_withTax = 450, meanbuyprice_withTax = 450, lastbuyprice_withDiscountAndTax = 450
                where sellbilldetailid = 5479;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2381, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 27, 0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12690, sellCostBuyPrice =sellCostBuyPrice+12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+27
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 12690, 12150, 12150
                    , 12150, 12150, 12150, 12150
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12150, 12150, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+12690, sellCostBuyPrice =sellCostBuyPrice+12150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+12150, sellCostMeanBuyPrice = sellCostMeanBuyPrice+12150
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+12150, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+12150
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+12150
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+12150
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+12150
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '275', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3775';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2381', '1', '27', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '302', '275', '1', '2026-10-22 20:09:44','0','0'); -- id=17184
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 7072;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('387','02402', '1384', '122', '2402', '9.00', '430', '3870', '0', '', '0', '2026-10-22 20:09:44', '2402', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7072-9,','1','1','0','0','430','3870','0','','0','0.00','0','0','0','0'); -- id=5480
UPDATE sellbilldetail SET  lastbuyprice = 430.00 , meanbuyprice = 430.00, lastbuyprice_withDiscount = 387.00, meanbuyprice_withDiscount = 387.00
        , lastbuyprice_withTax = 430, meanbuyprice_withTax = 430, lastbuyprice_withDiscountAndTax = 387
                where sellbilldetailid = 5480;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2402, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3870, 3870, 3870
                    , 3870, 3483, 3483, 3483
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3870, 3870, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3870, sellCostBuyPrice =sellCostBuyPrice+3870
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3870, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3870
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3483, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3483
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3483
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3870
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3870
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22 20:09:44' WHERE storedetailid = '3797';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2402', '1', '9', '1', '1384', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9', '0', '1', '2026-10-22 20:09:44','0','0'); -- id=17185
UPDATE dailyentry SET totalcreditor = '85650.00', totaldebtor = '85650.00', thedate = '2026-10-22', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:14:20', entryComment = 'اضافة فاتورة مبيعات رقم 1299', fromFlag = '1',related='0',isopeningentry='0',operationId='1299',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1299' WHERE id = '4504';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '85650.00', '85650.00', '2026-10-22', '1', '0', '4504', '2026-10-22 20:09:44','تم عكس القيد رقم 4504 ','1','0','0','0','0',''); -- id=4723
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4723', '419', '85650.00', '','0'); -- id=4725
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8805780.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4723', '143', '85650.00', '','0'); -- id=4857
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15468045', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '81288.00', totaldebtor = '81288.00', thedate = '2026-10-22', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:14:20', entryComment = 'اضافة فاتورة مبيعات رقم 1299 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='1299',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1299' WHERE id = '4505';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '81288.00', '81288.00', '2026-10-22', '1', '0', '4505', '2026-10-22 20:09:44','تم عكس القيد رقم 4505 ','1','0','0','0','0',''); -- id=4724
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4724', '402', '81288.00', '','0'); -- id=4726
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14306159.31', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4724', '382', '81288.00', '','0'); -- id=4858
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27891376.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '85650', '85650', '2026-10-22', '1', '0', '0', '2026-10-22 20:09:44','اضافة فاتورة مبيعات رقم 1384','1','0',null,'0','1384','sellbillController.php?do=showDetail&sellbillid=1384'); -- id=4725
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4725', '538', '85650', '','0'); -- id=4859
UPDATE accountstree SET name = 'الطوخي - عميل', customName = 'الطوخي - عميل', customNameEn = 'الطوخي - عميل', nameEn = 'الطوخي - عميل', parent = '58', accountNature = '0', theValue = '145225', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '538';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4725', '143', '85650', '','0'); -- id=4727
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15553695', 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 ( '81288', '81288', '2026-10-22', '1', '0', '0', '2026-10-22 20:09:44','اضافة فاتورة مبيعات رقم 1384 - صرف البضاعة من المخزن','1','0',null,'0','1384','sellbillController.php?do=showDetail&sellbillid=1384'); -- id=4726
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4726', '402', '81288', '','0'); -- id=4860
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14387447.31', 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 ('4726', '382', '81288', '','0'); -- id=4728
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27810088.89', 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='4725,0,4726' where sellbillid=1384;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85650, sellCostBuyPrice =sellCostBuyPrice+81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (40, '2026-10-22', 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,81675, 81675, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+85650, sellCostBuyPrice =sellCostBuyPrice+81675
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+81675, sellCostMeanBuyPrice = sellCostMeanBuyPrice+81675
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+81288, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+81288
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+81288
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+81675
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+81675
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 85650, 81675, 81675
                    , 81675, 81288, 81288, 81288, 81675, 81675)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+85650, netSellCostBuyPrice = netSellCostBuyPrice+81675
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+81675
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+81675
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+81288
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+81288
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+81288
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+81675
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+81675;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 1299 and newid=1384 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:39:44";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:09:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:09:44', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=1384'); -- id=19107
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:10:05', '1', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=19108
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 1302;
UPDATE sellbill SET  sellbillsysdate = '2026-10-22 20:10:05', userid = '2',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '1302';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-7 where id = 6765;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-5 where id = 6989;
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5232;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3468
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3468
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '100', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '12', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '88', '100', '1', '2026-10-22 13:27:17','0','0'); -- id=17186
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 6517;
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 5233;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2207, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2220, sellCostBuyPrice =sellCostBuyPrice-2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2220
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2220, sellCostBuyPrice =sellCostBuyPrice-2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2220
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '9', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '3598';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2207', '1', '6', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '3', '9', '1', '2026-10-22 13:27:17','0','0'); -- id=17187
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-6 where id = 6518;
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5234;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2208, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0,6,0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2100, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-6
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2100, sellCostBuyPrice =sellCostBuyPrice-2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2100
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '21', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '3599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2208', '1', '6', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '15', '21', '1', '2026-10-22 13:27:17','0','0'); -- id=17188
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-9 where id = 1166;
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5235;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0,9,0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2970, sellCostBuyPrice =sellCostBuyPrice-2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2880
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-9
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-2970, sellCostBuyPrice =sellCostBuyPrice-2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice-2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-2880
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '9', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '39', '1', '2026-10-22 13:27:17','0','0'); -- id=17189
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 1170;
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5236;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3720
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3840, sellCostBuyPrice =sellCostBuyPrice-3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3720
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '39', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '12', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '27', '39', '1', '2026-10-22 13:27:17','0','0'); -- id=17190
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 1166;
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5237;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0,3,0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-990, sellCostBuyPrice =sellCostBuyPrice-960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-960
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-3
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-990, sellCostBuyPrice =sellCostBuyPrice-960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-960, sellCostMeanBuyPrice = sellCostMeanBuyPrice-960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-960
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '3', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '39', '42', '1', '2026-10-22 13:27:17','0','0'); -- id=17191
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-12 where id = 6535;
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 299.38, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 299.38
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 299.38, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5238;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1205, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0,12,0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3592.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-12
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-3720, sellCostBuyPrice =sellCostBuyPrice-3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice-3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-3592.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '42', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1205', '1', '12', '0', '1302', 'تعديل فاتورة مبيعات', 'sellbillController.php', '30', '42', '1', '2026-10-22 13:27:17','0','0'); -- id=17192
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','1302', '0', '2026-10-22 13:27:17', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '19680', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:27:17','0','0','',''); -- id=1623
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8786101',  userid = '1' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8805781','19680', '1', '2', 'تعديل فاتورة مبيعات', '1302', '8786101', '2026-10-22 20:10:05', '1',  'sellbillController.php','1','','0'); -- id=1710
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19680, sellCostBuyPrice =sellCostBuyPrice-18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18940.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-19680, sellCostBuyPrice =sellCostBuyPrice-18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice-18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-18940.56
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516, 18948, 18940.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-19680, netSellCostBuyPrice = netSellCostBuyPrice-18948
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-18948
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-18940.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-18516
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-18508.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-18516
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-18948
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-18940.56;

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


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

COMMIT;
BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:27:17', '06ad9e3912c3d9', '40', '159570.00', '179250', '0', '1', '19680', '19680', '0', '19680', '1', '2026-10-22 13:27:17', '', '1', '0', 'الطوخي - عميل', '2', '1', '3', '0', 'الطوخي - عميل', '60', '1302', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=1385
UPDATE client SET  clientdebt = '179250', userid = '1' WHERE clientid = '40';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','159570.00','19680','0','اضافة فاتورة مبيعات (معدله)','1385', '179250', '2026-10-22 20:10:05', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '19680', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:27:17','0','0','',''); -- id=1624
UPDATE client SET  inUse = 0 where clientid = 40;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+7 where id = 6765;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+5 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1385', '147', '1886', '12.00', '320', '3840', '0', '', '0', '2026-10-22 20:10:05', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6765-7,6989-5,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5481
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5481;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3468, 3468
                    , 3468, 3468, 3468, 3468
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3468, 3468, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3468
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3468, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3468
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3468, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3468
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3468
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3468
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3468
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '88', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '12', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '100', '88', '1', '2026-10-22 20:10:05','0','0'); -- id=17193
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6517;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('333','02207', '1385', '48', '2207', '6.00', '370', '2220', '0', '', '0', '2026-10-22 20:10:05', '2207', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6517-6,','1','1','0','0','370','2220','0','','0','0.00','0','0','0','0'); -- id=5482
UPDATE sellbilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 333.00, meanbuyprice_withDiscount = 333.00
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 333
                where sellbilldetailid = 5482;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2207, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2220, 2220, 2220
                    , 2220, 1998, 1998, 1998
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2220, 2220, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2220, sellCostBuyPrice =sellCostBuyPrice+2220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1998, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1998
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1998
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2220
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2220
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '3', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '3598';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2207', '1', '6', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '9', '3', '1', '2026-10-22 20:10:05','0','0'); -- id=17194
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+6 where id = 6518;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('315','02208', '1385', '48', '2208', '6.00', '350', '2100', '0', '', '0', '2026-10-22 20:10:05', '2208', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6518-6,','1','1','0','0','350','2100','0','','0','0.00','0','0','0','0'); -- id=5483
UPDATE sellbilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 315.00, meanbuyprice_withDiscount = 315.00
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 350, lastbuyprice_withDiscountAndTax = 315
                where sellbilldetailid = 5483;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2208, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2100, 2100
                    , 2100, 1890, 1890, 1890
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2100, 2100, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2100
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2100, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2100
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1890, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1890
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1890
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2100
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2100
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '3599';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2208', '1', '6', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '21', '15', '1', '2026-10-22 20:10:05','0','0'); -- id=17195
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+9 where id = 1166;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01972', '1385', '59', '1972', '9.00', '330', '2970', '0', '', '0', '2026-10-22 20:10:05', '1972', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1166-9,','1','1','0','0','330','2970','0','','0','0.00','0','0','0','0'); -- id=5484
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5484;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 9, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+9
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2970, 2880, 2880
                    , 2880, 2880, 2880, 2880
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2880, 2880, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2970, sellCostBuyPrice =sellCostBuyPrice+2880
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2880, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2880
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2880, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2880
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2880
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2880
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2880
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '33', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '9', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '42', '33', '1', '2026-10-22 20:10:05','0','0'); -- id=17196
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 1170;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('310','01976', '1385', '59', '1976', '12.00', '320', '3840', '0', '', '0', '2026-10-22 20:10:05', '1976', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1170-12,','1','1','0','0','320','3840','0','','0','0.00','0','0','0','0'); -- id=5485
UPDATE sellbilldetail SET  lastbuyprice = 310.00 , meanbuyprice = 310.00, lastbuyprice_withDiscount = 310.00, meanbuyprice_withDiscount = 310.00
        , lastbuyprice_withTax = 310, meanbuyprice_withTax = 310, lastbuyprice_withDiscountAndTax = 310
                where sellbilldetailid = 5485;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1976, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3840, 3720, 3720
                    , 3720, 3720, 3720, 3720
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3720, 3720, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3840, sellCostBuyPrice =sellCostBuyPrice+3720
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3720, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3720, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3720
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3720
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3720
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2993';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1976', '1', '12', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '39', '27', '1', '2026-10-22 20:10:05','0','0'); -- id=17197
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1166;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('320','01972', '1385', '59', '1972', '3.00', '330', '990', '0', '', '0', '2026-10-22 20:10:05', '1972', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','1166-3,','1','1','0','0','330','990','0','','0','0.00','0','0','0','0'); -- id=5486
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 320.00, meanbuyprice_withDiscount = 320.00
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 320
                where sellbilldetailid = 5486;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1972, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 990, 960, 960
                    , 960, 960, 960, 960
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+990, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+960, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+960
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+960
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '2989';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1972', '1', '3', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '33', '30', '1', '2026-10-22 20:10:05','0','0'); -- id=17198
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+12 where id = 6535;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('300','09499', '1385', '59', '1205', '12.00', '310', '3720', '0', '', '0', '2026-10-22 20:10:05', '1205', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6535-12,','1','1','0','0','310','3720','0','','0','0.00','0','0','0','0'); -- id=5487
UPDATE sellbilldetail SET  lastbuyprice = 300.00 , meanbuyprice = 299.38, lastbuyprice_withDiscount = 300.00, meanbuyprice_withDiscount = 299.38
        , lastbuyprice_withTax = 300, meanbuyprice_withTax = 299.38, lastbuyprice_withDiscountAndTax = 300
                where sellbilldetailid = 5487;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1205, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 12, 0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3720, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3592.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+12
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 3720, 3600, 3600
                    , 3592.56, 3600, 3592.56, 3600
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3600, 3592.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+3720, sellCostBuyPrice =sellCostBuyPrice+3600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+3600, sellCostMeanBuyPrice = sellCostMeanBuyPrice+3592.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+3600, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+3592.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+3600
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+3600
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+3592.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-22 20:10:05' WHERE storedetailid = '1205';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1205', '1', '12', '1', '1385', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '42', '30', '1', '2026-10-22 20:10:05','0','0'); -- id=17199
UPDATE dailyentry SET totalcreditor = '19680.00', totaldebtor = '19680.00', thedate = '2026-10-22', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:27:18', entryComment = 'اضافة فاتورة مبيعات رقم 1302', fromFlag = '1',related='0',isopeningentry='0',operationId='1302',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1302' WHERE id = '4511';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19680.00', '19680.00', '2026-10-22', '1', '0', '4511', '2026-10-22 20:10:05','تم عكس القيد رقم 4511 ','1','0','0','0','0',''); -- id=4727
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4727', '419', '19680.00', '','0'); -- id=4729
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8786100.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4727', '143', '19680.00', '','0'); -- id=4861
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15534015', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '18516.00', totaldebtor = '18516.00', thedate = '2026-10-22', userid = '2', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:27:18', entryComment = 'اضافة فاتورة مبيعات رقم 1302 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='1302',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1302' WHERE id = '4512';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '18516.00', '18516.00', '2026-10-22', '1', '0', '4512', '2026-10-22 20:10:05','تم عكس القيد رقم 4512 ','1','0','0','0','0',''); -- id=4728
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4728', '402', '18516.00', '','0'); -- id=4730
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14368931.31', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4728', '382', '18516.00', '','0'); -- id=4862
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27828604.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19680', '19680', '2026-10-22', '1', '0', '0', '2026-10-22 20:10:05','اضافة فاتورة مبيعات رقم 1385','1','0',null,'0','1385','sellbillController.php?do=showDetail&sellbillid=1385'); -- id=4729
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4729', '538', '19680', '','0'); -- id=4863
UPDATE accountstree SET name = 'الطوخي - عميل', customName = 'الطوخي - عميل', customNameEn = 'الطوخي - عميل', nameEn = 'الطوخي - عميل', parent = '58', accountNature = '0', theValue = '164905', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '538';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4729', '143', '19680', '','0'); -- id=4731
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15553695', 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 ( '18516', '18516', '2026-10-22', '1', '0', '0', '2026-10-22 20:10:05','اضافة فاتورة مبيعات رقم 1385 - صرف البضاعة من المخزن','1','0',null,'0','1385','sellbillController.php?do=showDetail&sellbillid=1385'); -- id=4730
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4730', '402', '18516', '','0'); -- id=4864
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14387447.31', 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 ('4730', '382', '18516', '','0'); -- id=4732
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27810088.89', 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='4729,0,4730' where sellbillid=1385;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19680, sellCostBuyPrice =sellCostBuyPrice+18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18940.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (40, '2026-10-22', 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,18948, 18940.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+19680, sellCostBuyPrice =sellCostBuyPrice+18948
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+18948, sellCostMeanBuyPrice = sellCostMeanBuyPrice+18940.56
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+18516, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+18508.56
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+18516
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+18948
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18940.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 19680, 18948, 18948
                    , 18940.56, 18516, 18508.56, 18516, 18948, 18940.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+19680, netSellCostBuyPrice = netSellCostBuyPrice+18948
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+18948
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+18940.56
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+18516
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+18508.56
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+18516
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+18948
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18940.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 1302 and newid=1385 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:05";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:10:05', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=1385'); -- id=19109
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-22 20:10:09', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php'); -- id=19110
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-22 20:10:22', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=add'); -- id=19111

-- ----------------------------------------------------------------------------------------------------
-- clientPayedDeptController add - with modelid =1625
-- ----------------------------------------------------------------------------------------------------

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

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

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-22 20:10:22', '1', 'sucess', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=sucess'); -- id=19112
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('clientPayedDeptController.php', '2026-10-22 20:10:23', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/clientPayedDeptController.php?do=show'); -- id=19113
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:10:37', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19114
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:40:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:10:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:10:40', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19115
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:47:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:17:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:17:07', '1', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19116
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:47:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:17:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:17:55', '1', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19117
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:49:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:19:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:19:04', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19118
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:49:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:19:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:19:36', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=19119
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('بوكس فيت ليزر','','123','460','460','0','0','2026-10-22','0','1','0','','0','0','0','0','0','460','460','460','460','460','0','0','0','0','.','0','0','0','460','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','460','460','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','460','0','0','0','0','0','0','','','0','0','0','0'); -- id=2474
UPDATE product SET productName = 'بوكس فيت ليزر', productDescription = '', productCatId = '123', productBuyPrice = '460', productSellAllPrice = '460', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02474',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2474';
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', '2474', '1.00', '2026-10-22', '1', '0','0247401','460','0','0','460','','0','0','0','0','0','0','0','0','0','0'); -- id=2474
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2474', '1', '0', '1', '2026-10-22'); -- id=3869
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2474', '1', '0', '0', '2474', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-22','0','0'); -- id=17200
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2474, 1,'2026-10-22 20:19:36',1)
                ON DUPLICATE KEY UPDATE productid = 2474, edited = 1, sysdate = '2026-10-22 20:19:36', userid = 1; -- id=3698
UPDATE product SET productName = 'بوكس فيت ليزر', productDescription = '', productCatId = '123', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02474',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '460',meanbuyprice = '460',meanbuyprice_withDiscount = '460' , productbuypricereal = '460' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='460',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2474';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:49:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:19:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:19:37', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19120
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:49:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:19:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:19:42', '1', 'bill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=19121
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:50:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:20:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:20:37', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=19122
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 ('06ada45aed3e40', '2026-10-22 20:19:42', '119', '106056.00', '115992', '10', '1', '11040.00',  '9936.00', '0', '9936', '1', '2026-10-22 20:20:37', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=357
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 ('02474', '357', '123', '2474', '24', '460', '11040.00', '0', '', '2026-10-22 20:20:37', '2474','','','0','0','0','0','0',null,'460','11040','0','0','0','0','0','0','0','0','1'); -- id=1869
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 20:19:42', 1, 2474, 0, 0
                    , 414, 24, 0, 0, 1, '2026-10-22 20:20:37')
                ON DUPLICATE KEY UPDATE buyprice = 414,
                        buyQuantity =buyQuantity+24, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:20:37' ; -- id=7211
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2474', '460', '24', '0', 'buyBillController.php', '1869', '', '0', '0'); -- id=1400
UPDATE product SET  productBuyPrice = "460" WHERE productId = 2474 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1869 ;
UPDATE product SET productName = 'بوكس فيت ليزر', productDescription = '', productCatId = '123', productBuyPrice = '460.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02474',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '460',lastbuyprice_withDiscount = '414',meanbuyprice = '460',meanbuyprice_withDiscount = '414' , productbuypricereal = '460.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='460',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='460',meanbuyprice_withTax='460',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='414',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2474';
UPDATE buybilldetail SET  lastbuyprice = 460 , meanbuyprice = 460, lastbuyprice_withDiscount = 414, meanbuyprice_withDiscount = 414
        , lastbuyprice_withTax = 460, meanbuyprice_withTax = 460, lastbuyprice_withDiscountAndTax = 414
                where buybilldetailid = 1869;
UPDATE productunit SET proUnitBuyPrice  = 460 * productnumber WHERE productid = 2474;
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3869';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2474', '1', '24', '0', '357', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '24', '1', '2026-10-22 20:19:42','0','0'); -- id=17201
UPDATE supplier SET  suppliercurrentDebt = '115992',suppliercurrentDebtInCurrency= '115992' , userid = '1', supplierdate = '2026-10-22 20:20:37'   WHERE supplierid = '119';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('119', '106056.00', '9936', '0', 'اضافة فاتورة مشتريات', '357', '115992', '2026-10-22 20:19:42', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','9936','1','106056','9936','115992','0',''); -- id=926
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '9936', '9936', '2026-10-22', '1', '0', '0', '2026-10-22 20:20:37','اضافة فاتورة مشتريات رقم 357','1','0',null,'0','357','buyBillController.php?do=details&id=357'); -- id=4732
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4732', '382', '9936', '','0'); -- id=4866
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27820024.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4732', '602', '9936', '','0'); -- id=4734
UPDATE accountstree SET name = 'ليزر 2', customName = 'ليزر 2', customNameEn = 'ليزر 2', nameEn = 'ليزر 2', parent = '81', accountNature = '1', theValue = '115992', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 10:40:45' WHERE id = '602';
update buybill set dailyentryid='4732,0' where buybillid=357;
COMMIT;
UPDATE product SET overAllAveragePrice = 414 WHERE productId = 2474;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:50:38";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:20:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:20:38', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=357'); -- id=19123
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:50:41";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:20:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:20:41', '1', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=357&type=2'); -- id=19124
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:53:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:23:42", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 20:23:42', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19125
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:53:43";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 20:23:43", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 20:23:43', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19126
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:53:46";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:23:46", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:23:46', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19127
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:56:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:26:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 20:26:07', '1', 'showbarcodebuybill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcodebuybill&buybillid=357&type=2'); -- id=19128
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:56:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:26:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:26:23', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19129
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:56:37";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:26:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:26:37', '1', 'editbill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=354'); -- id=19130
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:56:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:26:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:26:50', '1', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=19131
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 354;
UPDATE buybill SET  buybillsysdate = '2026-10-22 20:26:50', userid = '7',delbyuserid = '1', conditions = '1' WHERE buybillid = '354';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2461, 0, 0
                    , 365, 30, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-30, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7175
UPDATE buybilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 365.00, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 365.00
        , lastbuyprice_withTax = 365.00, meanbuyprice_withTax = 365.00, lastbuyprice_withDiscountAndTax = 365.00
                where buybilldetailid = 1843;
UPDATE product SET productName = 'شروال الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365',lastbuyprice_withDiscount = '0',meanbuyprice = '365.00',meanbuyprice_withDiscount = '365' , productbuypricereal = '365.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',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='365',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
UPDATE productunit SET proUnitBuyPrice  = 365 * productnumber WHERE productid = 2461;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3856';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2461', '1', '30', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '30', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17202
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 30, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-30, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7176
UPDATE buybilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 385.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385.00, meanbuyprice_withTax = 385.00, lastbuyprice_withDiscountAndTax = 385.00
                where buybilldetailid = 1844;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '0',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '415', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '30', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '445', '415', '1', '2026-10-22 18:08:56','0','0'); -- id=17203
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2463, 0, 0
                    , 355, 20, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-20, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7177
UPDATE buybilldetail SET  lastbuyprice = 355.00 , meanbuyprice = 355.00, lastbuyprice_withDiscount = 355.00, meanbuyprice_withDiscount = 355.00
        , lastbuyprice_withTax = 355.00, meanbuyprice_withTax = 355.00, lastbuyprice_withDiscountAndTax = 355.00
                where buybilldetailid = 1845;
UPDATE product SET productName = 'فاشون بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '355.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02463',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '0',meanbuyprice = '355.00',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.23' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2463';
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2463;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3858';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2463', '1', '20', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '20', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17204
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2464, 0, 0
                    , 350, 50, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-50, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7178
UPDATE buybilldetail SET  lastbuyprice = 350.00 , meanbuyprice = 350.00, lastbuyprice_withDiscount = 350.00, meanbuyprice_withDiscount = 350.00
        , lastbuyprice_withTax = 350.00, meanbuyprice_withTax = 350.00, lastbuyprice_withDiscountAndTax = 350.00
                where buybilldetailid = 1846;
UPDATE product SET productName = 'تطريز بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '350.00', productSellAllPrice = '365.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02464',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '0',meanbuyprice = '350.00',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.29' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2464';
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2464;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3859';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2464', '1', '50', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '50', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17205
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 15, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-15, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7176
UPDATE buybilldetail SET  lastbuyprice = 385.00 , meanbuyprice = 385.00, lastbuyprice_withDiscount = 0.00, meanbuyprice_withDiscount = 385.00
        , lastbuyprice_withTax = 385.00, meanbuyprice_withTax = 385.00, lastbuyprice_withDiscountAndTax = 0.00
                where buybilldetailid = 1847;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '0',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '400', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '15', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '415', '400', '1', '2026-10-22 18:08:56','0','0'); -- id=17206
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7180
UPDATE buybilldetail SET  lastbuyprice = 455.00 , meanbuyprice = 455.00, lastbuyprice_withDiscount = 455.00, meanbuyprice_withDiscount = 455.00
        , lastbuyprice_withTax = 455.00, meanbuyprice_withTax = 455.00, lastbuyprice_withDiscountAndTax = 455.00
                where buybilldetailid = 1848;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '0',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '90', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17207
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7180
UPDATE buybilldetail SET  lastbuyprice = 455.00 , meanbuyprice = 455.00, lastbuyprice_withDiscount = 0.00, meanbuyprice_withDiscount = 455.00
        , lastbuyprice_withTax = 455.00, meanbuyprice_withTax = 455.00, lastbuyprice_withDiscountAndTax = 0.00
                where buybilldetailid = 1849;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '0',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17208
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2466, 0, 0
                    , 410, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7182
UPDATE buybilldetail SET  lastbuyprice = 410.00 , meanbuyprice = 410.00, lastbuyprice_withDiscount = 410.00, meanbuyprice_withDiscount = 410.00
        , lastbuyprice_withTax = 410.00, meanbuyprice_withTax = 410.00, lastbuyprice_withDiscountAndTax = 410.00
                where buybilldetailid = 1850;
UPDATE product SET productName = 'طوكيو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '410.00', productSellAllPrice = '425.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02466',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '0',meanbuyprice = '410.00',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.66' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2466';
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 2466;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3861';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2466', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17209
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 60, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-60, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7183
UPDATE buybilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 370.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370.00, meanbuyprice_withTax = 370.00, lastbuyprice_withDiscountAndTax = 370.00
                where buybilldetailid = 1851;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '0',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '60', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '110', '50', '1', '2026-10-22 18:08:56','0','0'); -- id=17210
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2468, 0, 0
                    , 495, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7184
UPDATE buybilldetail SET  lastbuyprice = 495.00 , meanbuyprice = 495.00, lastbuyprice_withDiscount = 495.00, meanbuyprice_withDiscount = 495.00
        , lastbuyprice_withTax = 495.00, meanbuyprice_withTax = 495.00, lastbuyprice_withDiscountAndTax = 495.00
                where buybilldetailid = 1852;
UPDATE product SET productName = 'توجي دريبات بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '495.00', productSellAllPrice = '510.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '14072',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495',lastbuyprice_withDiscount = '0',meanbuyprice = '495.00',meanbuyprice_withDiscount = '495' , productbuypricereal = '495.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.03' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',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='495',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2468';
UPDATE productunit SET proUnitBuyPrice  = 495 * productnumber WHERE productid = 2468;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3863';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2468', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17211
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2469, 0, 0
                    , 380, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7185
UPDATE buybilldetail SET  lastbuyprice = 380.00 , meanbuyprice = 380.00, lastbuyprice_withDiscount = 380.00, meanbuyprice_withDiscount = 380.00
        , lastbuyprice_withTax = 380.00, meanbuyprice_withTax = 380.00, lastbuyprice_withDiscountAndTax = 380.00
                where buybilldetailid = 1853;
UPDATE product SET productName = 'نيو سكاي بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '380.00', productSellAllPrice = '395.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02469',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '0',meanbuyprice = '380.00',meanbuyprice_withDiscount = '380' , productbuypricereal = '380.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.95' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',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='380',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2469';
UPDATE productunit SET proUnitBuyPrice  = 380 * productnumber WHERE productid = 2469;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3864';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2469', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17212
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2470, 0, 0
                    , 440, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7186
UPDATE buybilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440.00, meanbuyprice_withTax = 440.00, lastbuyprice_withDiscountAndTax = 440.00
                where buybilldetailid = 1854;
UPDATE product SET productName = 'فريلد 1127 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '440.00', productSellAllPrice = '455.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02470',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '0',meanbuyprice = '440.00',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.41' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2470';
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2470;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3865';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2470', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17213
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 50, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-50, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7183
UPDATE buybilldetail SET  lastbuyprice = 370.00 , meanbuyprice = 370.00, lastbuyprice_withDiscount = 0.00, meanbuyprice_withDiscount = 370.00
        , lastbuyprice_withTax = 370.00, meanbuyprice_withTax = 370.00, lastbuyprice_withDiscountAndTax = 0.00
                where buybilldetailid = 1855;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '0',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '50', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '50', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17214
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2471, 0, 0
                    , 400, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7188
UPDATE buybilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 400.00, meanbuyprice_withDiscount = 400.00
        , lastbuyprice_withTax = 400.00, meanbuyprice_withTax = 400.00, lastbuyprice_withDiscountAndTax = 400.00
                where buybilldetailid = 1856;
UPDATE product SET productName = 'باجي جيب 1128 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '400.00', productSellAllPrice = '415.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02471',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '0',meanbuyprice = '400.00',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.75' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2471';
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 2471;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3866';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2471', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17215
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2472, 0, 0
                    , 445, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-45, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7189
UPDATE buybilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 445.00, meanbuyprice_withDiscount = 445.00
        , lastbuyprice_withTax = 445.00, meanbuyprice_withTax = 445.00, lastbuyprice_withDiscountAndTax = 445.00
                where buybilldetailid = 1857;
UPDATE product SET productName = 'بالون قصات 1130 بيتر هاني', productDescription = '', productCatId = '217', productBuyPrice = '445.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '04456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '0',meanbuyprice = '445.00',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.37' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2472';
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 2472;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3867';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2472', '1', '45', '1', '354', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '45', '0', '1', '2026-10-22 18:08:56','0','0'); -- id=17216
UPDATE supplier SET  suppliercurrentDebt = '60100',suppliercurrentDebtInCurrency= '60100' , userid = '1', supplierdate = '2026-10-22 20:26:50'   WHERE supplierid = '12';
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 ('12', '310275.00', '250175.00', '1', 'حذف فاتورة مشتريات - للتعديل', '354', '60100', '2026-10-22 18:08:56', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','250175','1','310275','250175','60100','0',''); -- id=927
UPDATE productserial SET del = 1
		 WHERE billid = 354;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ada27086d338', '2026-10-22 18:08:56', '12', '60100.00', '303600', '0', '0', '243500.00', '243500.00', '0.00', '243500', '1', '2026-10-22 20:26:50', '', '1', '0', '', '1', '1','1','354','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=358
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 ('02461', '358', '217', '2461', '30.00', '365', '10950.00', '0.00', '', '2026-10-22 20:26:50', '2461','','','0','0','0','0','0',null,'365','10950','0','0','0','0','0','0','0','0','1'); -- id=1870
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2461, 0, 0
                    , 365, 30, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 365,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7175
UPDATE product SET  productBuyPrice = "365" WHERE productId = 2461 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1870 ;
UPDATE product SET productName = 'شروال الو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '365.00', productSellAllPrice = '380.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02461',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365',lastbuyprice_withDiscount = '365',meanbuyprice = '365',meanbuyprice_withDiscount = '365' , productbuypricereal = '365.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.11' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='365',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='365',meanbuyprice_withTax='182.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='365',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2461';
UPDATE buybilldetail SET  lastbuyprice = 365 , meanbuyprice = 365, lastbuyprice_withDiscount = 365, meanbuyprice_withDiscount = 365
        , lastbuyprice_withTax = 365, meanbuyprice_withTax = 182.5, lastbuyprice_withDiscountAndTax = 365
                where buybilldetailid = 1870;
UPDATE productunit SET proUnitBuyPrice  = 365 * productnumber WHERE productid = 2461;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3856';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2461', '1', '30', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-22 18:08:56','0','0'); -- id=17217
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 ('02462', '358', '217', '2462', '30.00', '385', '11550.00', '0.00', '', '2026-10-22 20:26:50', '2462','','','0','0','0','0','0',null,'385','11550','0','0','0','0','0','0','0','0','1'); -- id=1871
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 30, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 385,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7176
UPDATE product SET  productBuyPrice = "385" WHERE productId = 2462 ;
UPDATE buybilldetail SET  quantitybefore = 400 WHERE buybilldetailid = 1871 ;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE buybilldetail SET  lastbuyprice = 385 , meanbuyprice = 385, lastbuyprice_withDiscount = 385, meanbuyprice_withDiscount = 385
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where buybilldetailid = 1871;
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '430', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '30', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '400', '430', '1', '2026-10-22 18:08:56','0','0'); -- id=17218
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 ('02463', '358', '217', '2463', '20.00', '355', '7100.00', '0.00', '', '2026-10-22 20:26:50', '2463','','','0','0','0','0','0',null,'355','7100','0','0','0','0','0','0','0','0','1'); -- id=1872
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2463, 0, 0
                    , 355, 20, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 355,
                        buyQuantity =buyQuantity+20, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7177
UPDATE product SET  productBuyPrice = "355" WHERE productId = 2463 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1872 ;
UPDATE product SET productName = 'فاشون بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '355.00', productSellAllPrice = '370.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02463',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '355',lastbuyprice_withDiscount = '355',meanbuyprice = '355',meanbuyprice_withDiscount = '355' , productbuypricereal = '355.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.23' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='355',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='355',meanbuyprice_withTax='177.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='355',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2463';
UPDATE buybilldetail SET  lastbuyprice = 355 , meanbuyprice = 355, lastbuyprice_withDiscount = 355, meanbuyprice_withDiscount = 355
        , lastbuyprice_withTax = 355, meanbuyprice_withTax = 177.5, lastbuyprice_withDiscountAndTax = 355
                where buybilldetailid = 1872;
UPDATE productunit SET proUnitBuyPrice  = 355 * productnumber WHERE productid = 2463;
UPDATE storedetail SET  productquantity = '20', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3858';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2463', '1', '20', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '20', '1', '2026-10-22 18:08:56','0','0'); -- id=17219
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 ('02464', '358', '217', '2464', '50.00', '350', '17500.00', '0.00', '', '2026-10-22 20:26:50', '2464','','','0','0','0','0','0',null,'350','17500','0','0','0','0','0','0','0','0','1'); -- id=1873
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2464, 0, 0
                    , 350, 50, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 350,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7178
UPDATE product SET  productBuyPrice = "350" WHERE productId = 2464 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1873 ;
UPDATE product SET productName = 'تطريز بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '350.00', productSellAllPrice = '365.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02464',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '350',lastbuyprice_withDiscount = '350',meanbuyprice = '350',meanbuyprice_withDiscount = '350' , productbuypricereal = '350.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.29' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='350',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='350',meanbuyprice_withTax='175',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='350',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2464';
UPDATE buybilldetail SET  lastbuyprice = 350 , meanbuyprice = 350, lastbuyprice_withDiscount = 350, meanbuyprice_withDiscount = 350
        , lastbuyprice_withTax = 350, meanbuyprice_withTax = 175, lastbuyprice_withDiscountAndTax = 350
                where buybilldetailid = 1873;
UPDATE productunit SET proUnitBuyPrice  = 350 * productnumber WHERE productid = 2464;
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3859';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2464', '1', '50', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '50', '1', '2026-10-22 18:08:56','0','0'); -- id=17220
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 ('02462', '358', '217', '2462', '15.00', '385', '5775.00', '0.00', '', '2026-10-22 20:26:50', '2462','','','0','0','0','0','0',null,'385','5775','0','0','0','0','0','0','0','0','1'); -- id=1874
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2462, 0, 0
                    , 385, 15, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 385,
                        buyQuantity =buyQuantity+15, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7176
UPDATE product SET  productBuyPrice = "385" WHERE productId = 2462 ;
UPDATE buybilldetail SET  quantitybefore = 430 WHERE buybilldetailid = 1874 ;
UPDATE product SET productName = 'موديلات 400 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '385.00', productSellAllPrice = '400.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02462',type ='0', expireDate = '0' , dailyentryId = '4667',isService = '0',isOptic = '0',lastbuyprice = '385',lastbuyprice_withDiscount = '385',meanbuyprice = '385',meanbuyprice_withDiscount = '385' , productbuypricereal = '385.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.90' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='385',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='385',meanbuyprice_withTax='385',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='385',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2462';
UPDATE buybilldetail SET  lastbuyprice = 385 , meanbuyprice = 385, lastbuyprice_withDiscount = 385, meanbuyprice_withDiscount = 385
        , lastbuyprice_withTax = 385, meanbuyprice_withTax = 385, lastbuyprice_withDiscountAndTax = 385
                where buybilldetailid = 1874;
UPDATE productunit SET proUnitBuyPrice  = 385 * productnumber WHERE productid = 2462;
UPDATE storedetail SET  productquantity = '445', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3857';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2462', '1', '15', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '430', '445', '1', '2026-10-22 18:08:56','0','0'); -- id=17221
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 ('02465', '358', '217', '2465', '45.00', '455', '20475.00', '0.00', '', '2026-10-22 20:26:50', '2465','','','0','0','0','0','0',null,'455','20475','0','0','0','0','0','0','0','0','1'); -- id=1875
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 455,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7180
UPDATE product SET  productBuyPrice = "455" WHERE productId = 2465 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1875 ;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE buybilldetail SET  lastbuyprice = 455 , meanbuyprice = 455, lastbuyprice_withDiscount = 455, meanbuyprice_withDiscount = 455
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 455
                where buybilldetailid = 1875;
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17222
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 ('02465', '358', '217', '2465', '45.00', '455', '20475.00', '0.00', '', '2026-10-22 20:26:50', '2465','','','0','0','0','0','0',null,'455','20475','0','0','0','0','0','0','0','0','1'); -- id=1876
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2465, 0, 0
                    , 455, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 455,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7180
UPDATE product SET  productBuyPrice = "455" WHERE productId = 2465 ;
UPDATE buybilldetail SET  quantitybefore = 45 WHERE buybilldetailid = 1876 ;
UPDATE product SET productName = 'موديلات 470 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '455.00', productSellAllPrice = '470.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02465',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455',lastbuyprice_withDiscount = '455',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '455.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.30' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='455',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='455',meanbuyprice_withTax='455',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='455',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2465';
UPDATE buybilldetail SET  lastbuyprice = 455 , meanbuyprice = 455, lastbuyprice_withDiscount = 455, meanbuyprice_withDiscount = 455
        , lastbuyprice_withTax = 455, meanbuyprice_withTax = 455, lastbuyprice_withDiscountAndTax = 455
                where buybilldetailid = 1876;
UPDATE productunit SET proUnitBuyPrice  = 455 * productnumber WHERE productid = 2465;
UPDATE storedetail SET  productquantity = '90', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3860';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2465', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '45', '90', '1', '2026-10-22 18:08:56','0','0'); -- id=17223
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 ('02466', '358', '217', '2466', '45.00', '410', '18450.00', '0.00', '', '2026-10-22 20:26:50', '2466','','','0','0','0','0','0',null,'410','18450','0','0','0','0','0','0','0','0','1'); -- id=1877
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2466, 0, 0
                    , 410, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 410,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7182
UPDATE product SET  productBuyPrice = "410" WHERE productId = 2466 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1877 ;
UPDATE product SET productName = 'طوكيو بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '410.00', productSellAllPrice = '425.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02466',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '410',lastbuyprice_withDiscount = '410',meanbuyprice = '410',meanbuyprice_withDiscount = '410' , productbuypricereal = '410.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.66' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='410',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='410',meanbuyprice_withTax='205',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='410',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2466';
UPDATE buybilldetail SET  lastbuyprice = 410 , meanbuyprice = 410, lastbuyprice_withDiscount = 410, meanbuyprice_withDiscount = 410
        , lastbuyprice_withTax = 410, meanbuyprice_withTax = 205, lastbuyprice_withDiscountAndTax = 410
                where buybilldetailid = 1877;
UPDATE productunit SET proUnitBuyPrice  = 410 * productnumber WHERE productid = 2466;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3861';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2466', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17224
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 ('02467', '358', '217', '2467', '60.00', '370', '22200.00', '0.00', '', '2026-10-22 20:26:50', '2467','','','0','0','0','0','0',null,'370','22200','0','0','0','0','0','0','0','0','1'); -- id=1878
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 60, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7183
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2467 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1878 ;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1878;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '60', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '1', '2026-10-22 18:08:56','0','0'); -- id=17225
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 ('14072', '358', '217', '2468', '45.00', '495', '22275.00', '0.00', '', '2026-10-22 20:26:50', '2468','','','0','0','0','0','0',null,'495','22275','0','0','0','0','0','0','0','0','1'); -- id=1879
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2468, 0, 0
                    , 495, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 495,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7184
UPDATE product SET  productBuyPrice = "495" WHERE productId = 2468 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1879 ;
UPDATE product SET productName = 'توجي دريبات بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '495.00', productSellAllPrice = '510.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '14072',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495',lastbuyprice_withDiscount = '495',meanbuyprice = '495',meanbuyprice_withDiscount = '495' , productbuypricereal = '495.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.03' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='495',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='495',meanbuyprice_withTax='247.5',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='495',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2468';
UPDATE buybilldetail SET  lastbuyprice = 495 , meanbuyprice = 495, lastbuyprice_withDiscount = 495, meanbuyprice_withDiscount = 495
        , lastbuyprice_withTax = 495, meanbuyprice_withTax = 247.5, lastbuyprice_withDiscountAndTax = 495
                where buybilldetailid = 1879;
UPDATE productunit SET proUnitBuyPrice  = 495 * productnumber WHERE productid = 2468;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3863';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2468', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17226
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 ('02469', '358', '217', '2469', '45.00', '380', '17100.00', '0.00', '', '2026-10-22 20:26:50', '2469','','','0','0','0','0','0',null,'380','17100','0','0','0','0','0','0','0','0','1'); -- id=1880
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2469, 0, 0
                    , 380, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 380,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7185
UPDATE product SET  productBuyPrice = "380" WHERE productId = 2469 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1880 ;
UPDATE product SET productName = 'نيو سكاي بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '380.00', productSellAllPrice = '395.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02469',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '380',lastbuyprice_withDiscount = '380',meanbuyprice = '380',meanbuyprice_withDiscount = '380' , productbuypricereal = '380.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.95' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='380',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='380',meanbuyprice_withTax='190',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='380',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2469';
UPDATE buybilldetail SET  lastbuyprice = 380 , meanbuyprice = 380, lastbuyprice_withDiscount = 380, meanbuyprice_withDiscount = 380
        , lastbuyprice_withTax = 380, meanbuyprice_withTax = 190, lastbuyprice_withDiscountAndTax = 380
                where buybilldetailid = 1880;
UPDATE productunit SET proUnitBuyPrice  = 380 * productnumber WHERE productid = 2469;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3864';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2469', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17227
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 ('02470', '358', '217', '2470', '45.00', '440', '19800.00', '0.00', '', '2026-10-22 20:26:50', '2470','','','0','0','0','0','0',null,'440','19800','0','0','0','0','0','0','0','0','1'); -- id=1881
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2470, 0, 0
                    , 440, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 440,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7186
UPDATE product SET  productBuyPrice = "440" WHERE productId = 2470 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1881 ;
UPDATE product SET productName = 'فريلد 1127 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '440.00', productSellAllPrice = '455.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02470',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '440',lastbuyprice_withDiscount = '440',meanbuyprice = '440',meanbuyprice_withDiscount = '440' , productbuypricereal = '440.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.41' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='440',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='440',meanbuyprice_withTax='220',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='440',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2470';
UPDATE buybilldetail SET  lastbuyprice = 440 , meanbuyprice = 440, lastbuyprice_withDiscount = 440, meanbuyprice_withDiscount = 440
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 220, lastbuyprice_withDiscountAndTax = 440
                where buybilldetailid = 1881;
UPDATE productunit SET proUnitBuyPrice  = 440 * productnumber WHERE productid = 2470;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3865';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2470', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17228
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 ('02467', '358', '217', '2467', '50.00', '370', '18500.00', '0.00', '', '2026-10-22 20:26:50', '2467','','','0','0','0','0','0',null,'370','18500','0','0','0','0','0','0','0','0','1'); -- id=1882
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2467, 0, 0
                    , 370, 50, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 370,
                        buyQuantity =buyQuantity+50, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7183
UPDATE product SET  productBuyPrice = "370" WHERE productId = 2467 ;
UPDATE buybilldetail SET  quantitybefore = 60 WHERE buybilldetailid = 1882 ;
UPDATE product SET productName = 'موديلات 385 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '370.00', productSellAllPrice = '385.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02467',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '370',lastbuyprice_withDiscount = '370',meanbuyprice = '370',meanbuyprice_withDiscount = '370' , productbuypricereal = '370.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '4.05' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='370',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='370',meanbuyprice_withTax='370',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='370',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2467';
UPDATE buybilldetail SET  lastbuyprice = 370 , meanbuyprice = 370, lastbuyprice_withDiscount = 370, meanbuyprice_withDiscount = 370
        , lastbuyprice_withTax = 370, meanbuyprice_withTax = 370, lastbuyprice_withDiscountAndTax = 370
                where buybilldetailid = 1882;
UPDATE productunit SET proUnitBuyPrice  = 370 * productnumber WHERE productid = 2467;
UPDATE storedetail SET  productquantity = '110', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3862';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2467', '1', '50', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '60', '110', '1', '2026-10-22 18:08:56','0','0'); -- id=17229
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 ('02471', '358', '217', '2471', '45.00', '400', '18000.00', '0.00', '', '2026-10-22 20:26:50', '2471','','','0','0','0','0','0',null,'400','18000','0','0','0','0','0','0','0','0','1'); -- id=1883
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2471, 0, 0
                    , 400, 45, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 400,
                        buyQuantity =buyQuantity+45, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7188
UPDATE product SET  productBuyPrice = "400" WHERE productId = 2471 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1883 ;
UPDATE product SET productName = 'باجي جيب 1128 بيتر نادر', productDescription = '', productCatId = '217', productBuyPrice = '400.00', productSellAllPrice = '415.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '02471',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '400',lastbuyprice_withDiscount = '400',meanbuyprice = '400',meanbuyprice_withDiscount = '400' , productbuypricereal = '400.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.75' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='400',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='400',meanbuyprice_withTax='200',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='400',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2471';
UPDATE buybilldetail SET  lastbuyprice = 400 , meanbuyprice = 400, lastbuyprice_withDiscount = 400, meanbuyprice_withDiscount = 400
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 200, lastbuyprice_withDiscountAndTax = 400
                where buybilldetailid = 1883;
UPDATE productunit SET proUnitBuyPrice  = 400 * productnumber WHERE productid = 2471;
UPDATE storedetail SET  productquantity = '45', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3866';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2471', '1', '45', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '45', '1', '2026-10-22 18:08:56','0','0'); -- id=17230
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 ('04456', '358', '217', '2472', '30.00', '445', '13350.00', '0.00', '', '2026-10-22 20:26:50', '2472','','','0','0','0','0','0',null,'445','13350','0','0','0','0','0','0','0','0','1'); -- id=1884
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 18:08:56', 1, 2472, 0, 0
                    , 445, 30, 0, 0, 1, '2026-10-22 20:26:50')
                ON DUPLICATE KEY UPDATE buyprice = 445,
                        buyQuantity =buyQuantity+30, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 20:26:50' ; -- id=7189
UPDATE product SET  productBuyPrice = "445" WHERE productId = 2472 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1884 ;
UPDATE product SET productName = 'بالون قصات 1130 بيتر هاني', productDescription = '', productCatId = '217', productBuyPrice = '445.00', productSellAllPrice = '460.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '7', limitamount = '0', parcode = '04456',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445',lastbuyprice_withDiscount = '445',meanbuyprice = '445',meanbuyprice_withDiscount = '445' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '3.37' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='445',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='445',meanbuyprice_withTax='178',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='1',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='0',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='445',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2472';
UPDATE buybilldetail SET  lastbuyprice = 445 , meanbuyprice = 445, lastbuyprice_withDiscount = 445, meanbuyprice_withDiscount = 445
        , lastbuyprice_withTax = 445, meanbuyprice_withTax = 178, lastbuyprice_withDiscountAndTax = 445
                where buybilldetailid = 1884;
UPDATE productunit SET proUnitBuyPrice  = 445 * productnumber WHERE productid = 2472;
UPDATE storedetail SET  productquantity = '30', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3867';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2472', '1', '30', '0', '358', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '30', '1', '2026-10-22 18:08:56','0','0'); -- id=17231
DELETE FROM productserial WHERE billid = 354
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '303600',suppliercurrentDebtInCurrency= '303600' , userid = '1', supplierdate = '2026-10-22 20:26:50'   WHERE supplierid = '12';
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 ('12', '60100.00', '243500', '0', 'اضافة فاتورة مشتريات', '358', '303600', '2026-10-22 20:26:50', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','250175','1','60100','243500','303600','0',''); -- id=928
UPDATE dailyentry SET totalcreditor = '250175.00', totaldebtor = '250175.00', thedate = '2026-10-22', userid = '7', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 18:19:14', entryComment = 'اضافة فاتورة مشتريات رقم 354', fromFlag = '1',related='0',isopeningentry='0',operationId='354',operationDetailLink='buyBillController.php?do=details&id=354' WHERE id = '4674';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '250175.00', '250175.00', '2026-10-22', '1', '0', '4674', '2026-10-22 20:26:50','تم عكس القيد رقم 4674 ','1','0','0','0','0',''); -- id=4733
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4733', '382', '250175.00', '','0'); -- id=4735
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27569849.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4733', '431', '250175.00', '','0'); -- id=4867
UPDATE accountstree SET name = 'بيتر نادر JP - مورد', customName = 'بيتر نادر JP - مورد', customNameEn = 'بيتر نادر JP - مورد', nameEn = 'بيتر نادر JP - مورد', parent = '81', accountNature = '1', theValue = '-30000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '431';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '243500', '243500', '2026-10-22', '1', '0', '0', '2026-10-22 20:26:50','اضافة فاتورة مشتريات رقم 358','1','0',null,'0','358','buyBillController.php?do=details&id=358'); -- id=4734
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4734', '382', '243500', '','0'); -- id=4868
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27813349.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4734', '431', '243500', '','0'); -- id=4736
UPDATE accountstree SET name = 'بيتر نادر JP - مورد', customName = 'بيتر نادر JP - مورد', customNameEn = 'بيتر نادر JP - مورد', nameEn = 'بيتر نادر JP - مورد', parent = '81', accountNature = '1', theValue = '213500', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 13:17:33' WHERE id = '431';
update buybill set dailyentryid='4734,0' where buybillid=358;
UPDATE product SET overAllAveragePrice = 365 WHERE productId = 2461;UPDATE product SET overAllAveragePrice = 385 WHERE productId = 2462;UPDATE product SET overAllAveragePrice = 355 WHERE productId = 2463;UPDATE product SET overAllAveragePrice = 350 WHERE productId = 2464;UPDATE product SET overAllAveragePrice = 455 WHERE productId = 2465;UPDATE product SET overAllAveragePrice = 410 WHERE productId = 2466;UPDATE product SET overAllAveragePrice = 370 WHERE productId = 2467;UPDATE product SET overAllAveragePrice = 495 WHERE productId = 2468;UPDATE product SET overAllAveragePrice = 380 WHERE productId = 2469;UPDATE product SET overAllAveragePrice = 440 WHERE productId = 2470;UPDATE product SET overAllAveragePrice = 400 WHERE productId = 2471;UPDATE product SET overAllAveragePrice = 445 WHERE productId = 2472;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 16:56:50";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:26:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 20:26:50', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=358'); -- id=19132
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:00:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:30:47", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:30:47', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19133

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada0a9cb4de2
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,autoSaveFlag,obgyBillType,billoperationid,obygyVisitId,pricetype,currencyId,sellbillno,returnsellbilltypeclientid) VALUES ('2026-10-22 20:30:47', '06ada0a9cb4de2', '1', '0.00', '0', '0', '1', '4500', '4500', '-4500', '0', '1', '2026-10-22 20:30:47', '', '6', '0', 'نقدي','4', '0', '5', '0', 'نقدي', '6', '0', '', '','','','-1','0','0','0','','0','-4500','0','0','0','0','0','0','0','0','-1','0','0','1','','0'); -- id=51
UPDATE client SET  clientdebt = '0', userid = '6' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','51', '0', '2026-10-22 20:30:47', '6', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '4500', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 20:30:47','0','0','',''); -- id=1626
INSERT INTO returnsellbilldetail (buyprice, parcode, returnsellbillid, returnsellbilldetailcatid, returnsellbilldetailproductid, returnsellbilldetailquantity, returnsellbilldetailprice, returnsellbilldetailtotalprice, conditions, note, pricetype, discountvalue, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,pricetypepro,proHeight,proWidth,soldSerialsInDetails,lastbuyprice_withTax,meanbuyprice_withTax,returnsellbilldetailpriceC,returnsellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,lastbuyprice_withDiscountAndTax) VALUES ('750.00', '01734', '51', '133', '1734', '6', '750', '4500', '0', '', '0', '0', '1734', '0.00', '-1','1','0','','','0','0','0','0','0','0','1','1','','0','0','750','4500','0','','0'); -- id=74
UPDATE returnsellbilldetail SET  lastbuyprice = 750.00 , meanbuyprice = 750.00, lastbuyprice_withDiscount = 750.00, meanbuyprice_withDiscount = 750.00
        , lastbuyprice_withTax = 750, meanbuyprice_withTax = 750, lastbuyprice_withDiscountAndTax = 750
                where returnsellbilldetailid = 74;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1734, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4500, 4500, 4500, 4500
                    , 4500, 4500, 4500, 0, 6, 0, 0, 4500, 4500)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4500, returnSellCostBuyPrice = returnSellCostBuyPrice+4500, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+4500
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4500, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+4500
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4500
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+4500
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+4500
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+4500
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+6;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4500, 4500, 4500, 4500
                    , 4500, 4500, 4500, 0, 0, 4500, 4500)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4500, returnSellCostBuyPrice = returnSellCostBuyPrice+4500, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+4500
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4500, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+4500
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4500
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+4500
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+4500
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+4500;
UPDATE storedetail SET  productquantity = '54', userid = '6', storedetaildate = '2026-10-22 20:30:47' WHERE storedetailid = '2747';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1734', '1', '6', '0', '51', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '48', '54', '6', '2026-10-22 20:30:47','0','0'); -- id=17232
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1376695',  userid = '6' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1381195','-4500', '1', '4', 'اضافة فاتورة مردوات مبيعات', '51', '1376695', '2026-10-22 20:30:47', '6',  'returnsellbillController.php','1','','0'); -- id=1712
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4500', '4500', '2026-10-22', '6', '0', '0', '2026-10-22 20:30:47','اضافة فاتورة مردود مبيعات رقم 51','1','0',null,'0','51','returnsellbillController.php?do=showDetail&returnsellbillid=51'); -- id=4735
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4735', '143', '4500', '','0'); -- id=4869
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15549195', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4735', '568', '4500', '','0'); -- id=4737
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1376695', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '4500', '4500', '2026-10-22', '6', '0', '0', '2026-10-22 20:30:47','اضافة فاتورة مردود مبيعات رقم 51 - صرف البضاعة من المخزن','1','0',null,'0','51','returnsellbillController.php?do=showDetail&returnsellbillid=51'); -- id=4736
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4736', '382', '4500', '','0'); -- id=4870
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27817849.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4736', '402', '4500', '','0'); -- id=4738
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14382947.31', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
update returnsellbill set dailyentryid='4735,0,4736' where returnsellbillid=51;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4500, 4500, 4500, 4500
                    , 4500, 4500, 4500 ,0, 0, 4500, 4500)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4500, returnSellCostBuyPrice = returnSellCostBuyPrice+4500, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+4500
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4500, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+4500
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4500
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+4500
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+4500
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+4500;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 0, 0, 0
                    , 0, 0, 0, 0
                    , 4500, 4500, 4500, 4500
                    , 4500, 4500, 4500 ,0, 0, 4500, 4500)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+0, sellCostBuyPrice =sellCostBuyPrice+0
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+0, sellCostMeanBuyPrice = sellCostMeanBuyPrice+0
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+0, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+0
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+0
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+0
                        , returnSellVal = returnSellVal+4500, returnSellCostBuyPrice = returnSellCostBuyPrice+4500, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+4500
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+4500, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+4500
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+4500
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+4500
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+4500
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+4500;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, -4500, -4500, -4500
                    , -4500, -4500, -4500, -4500, -4500, -4500)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-4500, netSellCostBuyPrice = netSellCostBuyPrice+-4500
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-4500
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-4500
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-4500
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-4500
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+-4500
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+-4500
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+-4500;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada0a9cb4de2 and sellbillId = 51 and returnsellbillId = 51
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:00:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:30:47", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:30:47', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=5'); -- id=19134
update user set blockedByLimits = 0;
update user set blockedByLimits = 0;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:03:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:33:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 20:33:09', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19135
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:03:09";
UPDATE user SET loginip = "51.89.20.165", lastactivetime = "2026-10-22 20:33:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 20:33:09', '2', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19136
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:03:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:33:10", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:33:10', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19137
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:47";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:52";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:34:52", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 20:34:52', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19138
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:52";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 20:34:52', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19139
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:54";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:34:58", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:34:58', '6', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19140

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada32077944f
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada32077944f and sellbillId = 1386 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:58";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:34:58", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:34:58', '6', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19141
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:04:58";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:34:58", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:34:58', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=19142
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:05:33";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:35:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-22 20:35:33', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=19143
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:05:55";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:35:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:35:55', '1', 'add', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=add'); -- id=19144
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '5', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '1', '6', '1', '2026-10-22','0','0'); -- id=17234
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1250', '1250', '2026-10-22', '1', '0', '0', '2026-10-22 20:35:55','اعادة جرد للمنتج : (جبردين سيفن ار/سيفن ار) فى مخزن : (المخزن الرئيسي) بالكمية : 6','1','0',null,'0','17234','inventoryController.php?do=details&id=17234'); -- id=4739
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4739', '382', '1250', '','0'); -- id=4873
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27814499.89', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4739', '188', '1250', '','0'); -- id=4741
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3250130', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:05:56";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:35:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventorybybarcodeController.php', '2026-10-22 20:35:56', '1', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/inventorybybarcodeController.php'); -- id=19145
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:06:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:36:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:36:09', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19146

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada40c8e2a67
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,qrerpid,qrerpids,autoSaveFlag,ereason,estatus,epdf,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,sellbilltypeclientid,shipfrom,shipto,paymethodshipping,whatShippingCost,clientaddress,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 20:36:09', '06ada40c8e2a67', '1', '0.00', '0', '0', '1', '15320.00', '15320', '15320', '0', '1', '2026-10-22 20:36:09', '', '2', '0', 'نقدي', '2', '0', '3', '0', 'نقدي', '34' ,'0','','','','','-1','0','0','0','0','0','15320','0','','0','0','15320','0','0','0','0','0','0','0','0','','','','0','','0','','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','','','0','0','0',''); -- id=1387
UPDATE client SET  clientdebt = '0', userid = '2' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','1387', '0', '2026-10-22 20:36:09', '2', 'sellbillController.php', 'اضافة فاتورة مبيعات', '15320', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 20:36:09','0','0','',''); -- id=1628
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6989;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('289','01886', '1387', '147', '1886', '3', '320', '960', '0', '', '0', '2026-10-22 20:36:09', '1886', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6989-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5489
UPDATE sellbilldetail SET  lastbuyprice = 289.00 , meanbuyprice = 289.00, lastbuyprice_withDiscount = 289.00, meanbuyprice_withDiscount = 289.00
        , lastbuyprice_withTax = 289, meanbuyprice_withTax = 289, lastbuyprice_withDiscountAndTax = 289
                where sellbilldetailid = 5489;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1886, '2026-10-22', 960, 867, 867
                    , 867, 867, 867, 867
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 867, 867, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+867
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+867, sellCostMeanBuyPrice = sellCostMeanBuyPrice+867
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+867, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+867
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+867
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+867
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+867
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 867, 867
                    , 867, 867, 867, 867
                    , 0, 0, 0, 0
                    , 0, 0, 0, 867, 867, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+867
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+867, sellCostMeanBuyPrice = sellCostMeanBuyPrice+867
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+867, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+867
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+867
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+867
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+867
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '85', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '2903';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1886', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '88', '85', '2', '2026-10-22 20:36:09','0','0'); -- id=17235
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 958;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('360','01880', '1387', '75', '1880', '3', '400', '1200', '0', '', '0', '2026-10-22 20:36:09', '1880', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','958-3,','1','1','0','0','400','1200','0','','0','0.00','0','0','0','0'); -- id=5490
UPDATE sellbilldetail SET  lastbuyprice = 400.00 , meanbuyprice = 400.00, lastbuyprice_withDiscount = 360.00, meanbuyprice_withDiscount = 204.85
        , lastbuyprice_withTax = 400, meanbuyprice_withTax = 1951.52, lastbuyprice_withDiscountAndTax = 360
                where sellbilldetailid = 5490;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1880, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1080, 614.55, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1200, 5854.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+614.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5854.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1200, 1200, 1200
                    , 1200, 1080, 614.55, 1080
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1200, 5854.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1080, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+614.55
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1080
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+5854.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '36', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '2897';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1880', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '39', '36', '2', '2026-10-22 20:36:09','0','0'); -- id=17236
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6948;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('297.6','02028', '1387', '166', '2028', '3', '320', '960', '0', '', '0', '2026-10-22 20:36:09', '2028', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6948-3,','1','1','0','0','320','960','0','','0','0.00','0','0','0','0'); -- id=5491
UPDATE sellbilldetail SET  lastbuyprice = 320.00 , meanbuyprice = 320.00, lastbuyprice_withDiscount = 297.60, meanbuyprice_withDiscount = 297.60
        , lastbuyprice_withTax = 320, meanbuyprice_withTax = 320, lastbuyprice_withDiscountAndTax = 297.6
                where sellbilldetailid = 5491;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2028, '2026-10-22', 960, 960, 960
                    , 960, 892.8, 892.8, 890.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+892.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+892.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+890.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 960, 960, 960
                    , 960, 892.8, 892.8, 890.88
                    , 0, 0, 0, 0
                    , 0, 0, 0, 960, 960, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+960, sellCostBuyPrice =sellCostBuyPrice+960
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+960, sellCostMeanBuyPrice = sellCostMeanBuyPrice+960
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+892.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+892.8
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+890.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+960
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+960
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '63', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '3387';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2028', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '66', '63', '2', '2026-10-22 20:36:09','0','0'); -- id=17237
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6583;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('324','02084', '1387', '43', '2084', '3', '360', '1080', '0', '', '0', '2026-10-22 20:36:09', '2084', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','6583-3,','1','1','0','0','360','1080','0','','0','0.00','0','0','0','0'); -- id=5492
UPDATE sellbilldetail SET  lastbuyprice = 360.00 , meanbuyprice = 360.00, lastbuyprice_withDiscount = 324.00, meanbuyprice_withDiscount = 324.00
        , lastbuyprice_withTax = 360, meanbuyprice_withTax = 360, lastbuyprice_withDiscountAndTax = 324
                where sellbilldetailid = 5492;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2084, '2026-10-22', 1080, 1080, 1080
                    , 1080, 972, 972, 972
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+972, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+972
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+972
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1080, 1080, 1080
                    , 1080, 972, 972, 972
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1080, 1080, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1080, sellCostBuyPrice =sellCostBuyPrice+1080
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1080, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1080
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+972, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+972
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+972
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1080
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1080
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '42', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '3443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2084', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '45', '42', '2', '2026-10-22 20:36:09','0','0'); -- id=17238
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('250','01376', '1387', '71', '1377', '6', '260', '1560', '0', '', '0', '2026-10-22 20:36:09', '1377', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','','1','1','0','0','260','1560','0','','0','0.00','0','0','0','0'); -- id=5493
UPDATE sellbilldetail SET  lastbuyprice = 250.00 , meanbuyprice = 250.00, lastbuyprice_withDiscount = 250.00, meanbuyprice_withDiscount = 250.00
        , lastbuyprice_withTax = 250, meanbuyprice_withTax = 250, lastbuyprice_withDiscountAndTax = 250
                where sellbilldetailid = 5493;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1377, '2026-10-22', 1560, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1560, 1500, 1500
                    , 1500, 1500, 1500, 1500
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1500, 1500, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1560, sellCostBuyPrice =sellCostBuyPrice+1500
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1500, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1500
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1500, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1500
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1500
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1500
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1500
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '6', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6', '0', '2', '2026-10-22 20:36:09','0','0'); -- id=17239
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 468;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('330','01625', '1387', '32', '1625', '3', '350', '1050', '0', '', '0', '2026-10-22 20:36:09', '1625', '0.00', '0', '1','0.00','','','0','0','0','0','0','0','0','0','','468-3,','1','1','0','0','350','1050','0','','0','0.00','0','0','0','0'); -- id=5494
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
        , lastbuyprice_withTax = 330, meanbuyprice_withTax = 165, lastbuyprice_withDiscountAndTax = 330
                where sellbilldetailid = 5494;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1625, '2026-10-22', 1050, 990, 990
                    , 990, 990, 990, 990
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 990, 495, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+990
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+990, sellCostMeanBuyPrice = sellCostMeanBuyPrice+990
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+990, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+990
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+990
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+495
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1050, 990, 990
                    , 990, 990, 990, 990
                    , 0, 0, 0, 0
                    , 0, 0, 0, 990, 495, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1050, sellCostBuyPrice =sellCostBuyPrice+990
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+990, sellCostMeanBuyPrice = sellCostMeanBuyPrice+990
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+990, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+990
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+990
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+990
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+495
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '120', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '1650';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1625', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '123', '120', '2', '2026-10-22 20:36:09','0','0'); -- id=17240
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 55;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('440','01370', '1387', '91', '1370', '1', '500', '500', '0', '', '0', '2026-10-22 20:36:09', '1370', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','55-1,','1','1','0','0','500','500','0','','0','0.00','0','0','0','0'); -- id=5495
UPDATE sellbilldetail SET  lastbuyprice = 440.00 , meanbuyprice = 440.00, lastbuyprice_withDiscount = 440.00, meanbuyprice_withDiscount = 440.00
        , lastbuyprice_withTax = 440, meanbuyprice_withTax = 440, lastbuyprice_withDiscountAndTax = 440
                where sellbilldetailid = 5495;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1370, '2026-10-22', 500, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+1
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 500, 440, 440
                    , 440, 440, 440, 440
                    , 0, 0, 0, 0
                    , 0, 0, 0, 440, 440, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+440
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+440
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+440
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '71', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '1370';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1370', '1', '1', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '72', '71', '2', '2026-10-22 20:36:09','0','0'); -- id=17241
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 1209;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01990', '1387', '161', '1990', '3', '850', '2550', '0', '', '0', '2026-10-22 20:36:09', '1990', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','1209-3,','1','1','0','0','850','2550','0','','0','0.00','0','0','0','0'); -- id=5496
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5496;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1990, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2550, 2400, 2400
                    , 2400, 2400, 2400, 2400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2400, 2400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2550, sellCostBuyPrice =sellCostBuyPrice+2400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '123', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '3007';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1990', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '126', '123', '2', '2026-10-22 20:36:09','0','0'); -- id=17242
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7074;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('670','02404', '1387', '194', '2404', '3', '700', '2100', '0', '', '0', '2026-10-22 20:36:09', '2404', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','7074-3,','1','1','0','0','700','2100','0','','0','0.00','0','0','0','0'); -- id=5497
UPDATE sellbilldetail SET  lastbuyprice = 670.00 , meanbuyprice = 670.00, lastbuyprice_withDiscount = 670.00, meanbuyprice_withDiscount = 670.00
        , lastbuyprice_withTax = 670, meanbuyprice_withTax = 670, lastbuyprice_withDiscountAndTax = 670
                where sellbilldetailid = 5497;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2404, '2026-10-22', 2100, 2010, 2010
                    , 2010, 2010, 2010, 2010
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 2010, 2010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2010
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2010
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2100, 2010, 2010
                    , 2010, 2010, 2010, 2010
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2010, 2010, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2100, sellCostBuyPrice =sellCostBuyPrice+2010
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+2010, sellCostMeanBuyPrice = sellCostMeanBuyPrice+2010
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+2010, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+2010
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+2010
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+2010
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+2010
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '24', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '3799';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2404', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '27', '24', '2', '2026-10-22 20:36:09','0','0'); -- id=17243
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 6799;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('420','02291', '1387', '203', '2291', '3', '450', '1350', '0', '', '0', '2026-10-22 20:36:09', '2291', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','6799-3,','1','1','0','0','450','1350','0','','0','0.00','0','0','0','0'); -- id=5498
UPDATE sellbilldetail SET  lastbuyprice = 420.00 , meanbuyprice = 420.00, lastbuyprice_withDiscount = 420.00, meanbuyprice_withDiscount = 420.00
        , lastbuyprice_withTax = 420, meanbuyprice_withTax = 420, lastbuyprice_withDiscountAndTax = 420
                where sellbilldetailid = 5498;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (2291, '2026-10-22', 1350, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 1350, 1260, 1260
                    , 1260, 1260, 1260, 1260
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1260, 1260, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1350, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1260
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1260
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1260
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '0', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '3684';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2291', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3', '0', '2', '2026-10-22 20:36:09','0','0'); -- id=17244
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 290;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('640','01512', '1387', '109', '1512', '3', '670', '2010', '0', '', '0', '2026-10-22 20:36:09', '1512', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','290-3,','1','1','0','0','670','2010','0','','0','0.00','0','0','0','0'); -- id=5499
UPDATE sellbilldetail SET  lastbuyprice = 640.00 , meanbuyprice = 640.00, lastbuyprice_withDiscount = 640.00, meanbuyprice_withDiscount = 640.00
        , lastbuyprice_withTax = 640, meanbuyprice_withTax = 640, lastbuyprice_withDiscountAndTax = 640
                where sellbilldetailid = 5499;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1512, '2026-10-22', 2010, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 3, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+3
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 2010, 1920, 1920
                    , 1920, 1920, 1920, 1920
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1920, 1920, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+2010, sellCostBuyPrice =sellCostBuyPrice+1920
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1920, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1920
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1920, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1920
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+1920
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+1920
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+1920
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '18', userid = '2', storedetaildate = '2026-10-22 20:36:09' WHERE storedetailid = '1537';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1512', '1', '3', '1', '1387', 'اضافة فاتورة مبيعات', 'sellbillController.php', '21', '18', '2', '2026-10-22 20:36:09','0','0'); -- id=17245
CALL saveInUse(2,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '8801421',  userid = '2' WHERE saveid = '2';
UPDATE save SET  inUse = 0 where saveid = 2;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('8786101','15320', '0', '2', 'اضافة فاتورة مبيعات', '1387', '8801421', '2026-10-22 20:36:09', '2',  'sellbillController.php','1','','0'); -- id=1714
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '15320', '15320', '2026-10-22', '2', '0', '0', '2026-10-22 20:36:09','اضافة فاتورة مبيعات رقم 1387','1','0',null,'0','1387','sellbillController.php?do=showDetail&sellbillid=1387'); -- id=4740
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4740', '419', '15320', '','0'); -- id=4874
UPDATE accountstree SET name = 'خزنة كاشير ', customName = 'خزنة كاشير ', customNameEn = 'خزنة كاشير ', nameEn = 'خزنة كاشير ', parent = '40', accountNature = '0', theValue = '8801420.15', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-27 18:07:37' WHERE id = '419';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4740', '143', '15320', '','0'); -- id=4742
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15570465', 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 ( '14331.8', '14331.8', '2026-10-22', '2', '0', '0', '2026-10-22 20:36:09','اضافة فاتورة مبيعات رقم 1387 - صرف البضاعة من المخزن','1','0',null,'0','1387','sellbillController.php?do=showDetail&sellbillid=1387'); -- id=4741
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4741', '402', '14331.8', '','0'); -- id=4875
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14401879.11', 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 ('4741', '382', '14331.8', '','0'); -- id=4743
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27800168.09', 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='4740,0,4741' where sellbillid=1387;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 15320, 14627, 14627
                    , 14627, 14331.8, 13866.35, 14329.88
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14627, 18786.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15320, sellCostBuyPrice =sellCostBuyPrice+14627
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14627, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14627
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14331.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13866.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14329.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14627
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18786.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15320, 14627, 14627
                    , 14627, 14331.8, 13866.35, 14329.88
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,14627, 18786.56, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15320, sellCostBuyPrice =sellCostBuyPrice+14627
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14627, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14627
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14331.8, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+13866.35
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14329.88
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14627
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+18786.56
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice,netSellCostLastBuyPricewithTax,netSellCostMeanBuyPricewithTax)
                    VALUES (1, 15320, 14627, 14627
                    , 14627, 14331.8, 13866.35, 14329.88, 14627, 18786.56)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+15320, netSellCostBuyPrice = netSellCostBuyPrice+14627
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+14627
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+14627
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+14331.8
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+13866.35
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+14329.88
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+14627
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+18786.56;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada40c8e2a67 and sellbillId = 1387 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:06:09";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:36:09", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:36:09', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19147
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:06:15";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:36:15", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:36:15', '1', 'autosave', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=19148
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0', '6', '1', '2026-10-22','0','0'); -- id=17246
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1500', '1500', '2026-10-22', '1', '0', '0', '2026-10-22 20:36:15','اعادة جرد للمنتج : (جبردين سيفن ار/سيفن ار) فى مخزن : (المخزن الرئيسي) بالكمية : 6','1','0',null,'0','17246','inventoryController.php?do=details&id=17246'); -- id=4742
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4742', '382', '1500', '','0'); -- id=4876
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27801668.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4742', '188', '1500', '','0'); -- id=4744
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3251630', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:06:19";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:06:38";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:36:38", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:36:38', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=19149
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:07:40";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:37:40", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:37:40', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=19150
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:07:45";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:37:45", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:37:45', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=19151
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:08:47";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:38:47", deviceType = "DESKTOP" WHERE userid = 6;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 20:38:47', '6', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=19152
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:10:19";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:40:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:40:19', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19153
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:10:21";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:40:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:40:21', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19154
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:11:40";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:41:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-10-22 20:41:40', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnsellbillController.php?do=show'); -- id=19155
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:11:42";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:41:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnsellbillController.php', '2026-10-22 20:41:42', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/returnsellbillController.php?do=show'); -- id=19156
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:04";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:04', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19157
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:07";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:07', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19158
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:11";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:11', '1', 'show', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=show'); -- id=19159
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:14";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:14', '1', 'editsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editsellBill&sellbillid=1313'); -- id=19160
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:28', '1', 'update', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=update'); -- id=19161
BEGIN;

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


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

UPDATE costcenterdetail SET del = 1 WHERE type in( 0) and  modelid = 1313;
UPDATE sellbill SET  sellbillsysdate = '2026-10-22 20:46:28', userid = '6',delbyuserid = '1', conditions = '1'  WHERE sellbillid = '1313';
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-15 where id = 561;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-3 where id = 7111;
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5282;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0,18,0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15300, sellCostBuyPrice =sellCostBuyPrice-14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-18
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-15300, sellCostBuyPrice =sellCostBuyPrice-14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice-14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-14400
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '85', userid = '1', storedetaildate = '2026-10-22 20:46:28' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '18', '0', '1313', 'تعديل فاتورة مبيعات', 'sellbillController.php', '67', '85', '1', '2026-10-22 13:54:43','0','0'); -- id=17247
UPDATE buypriceshistorybook set sellQuantity = sellQuantity-20 where id = 60;
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 240
                where sellbilldetailid = 5283;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1375, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0,20,0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6000, sellCostBuyPrice =sellCostBuyPrice-4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0
                        , netQuantity = netQuantity-20
                        , netQuantityRet = netQuantityRet-0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-6000, sellCostBuyPrice =sellCostBuyPrice-4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice-4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-4800
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
UPDATE storedetail SET  productquantity = '112', userid = '1', storedetaildate = '2026-10-22 20:46:28' WHERE storedetailid = '1375';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1375', '1', '20', '0', '1313', 'تعديل فاتورة مبيعات', 'sellbillController.php', '92', '112', '1', '2026-10-22 13:54:43','0','0'); -- id=17248
UPDATE client SET  clientdebt = '0', userid = '1' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('1','0.00','0.00','1','تعديل فاتورة مبيعات','1313', '0', '2026-10-22 13:54:43', '1', 'sellbillController.php', 'تعديل فاتورة مبيعات', '21300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:54:43','0','0','',''); -- id=1629
CALL saveInUse(4,@saveidis,@savecurrentvalueis,@currencyIdis,@treeIdis,@conversionFactoris);
UPDATE save SET  savecurrentvalue = '1361345',  userid = '1' WHERE saveid = '4';
UPDATE save SET  inUse = 0 where saveid = 4;
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note,clientdebtchangeidfk) VALUES ('1382645','21300', '1', '4', 'تعديل فاتورة مبيعات', '1313', '1361345', '2026-10-22 20:46:28', '1',  'sellbillController.php','1','','0'); -- id=1715
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21300, sellCostBuyPrice =sellCostBuyPrice-19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice-0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice-0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount-0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount-0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice-0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax-0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax-0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0, 19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal-21300, sellCostBuyPrice =sellCostBuyPrice-19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice-19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice-19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount-19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount-19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice-19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax-19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax-19200
                        , returnSellVal = returnSellVal-0, returnSellCostBuyPrice = returnSellCostBuyPrice-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, 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200, 19200, 19200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal-21300, netSellCostBuyPrice = netSellCostBuyPrice-19200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice-19200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice-19200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount-19200
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount-19200
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice-19200
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax-19200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax-19200;

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


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

COMMIT;
BEGIN;
CALL clientInUse(40,@clientdebt,@clientname,@treeIdis);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,deletedsellid,controlname,tax, carnumber, cartype, carchase, carmotor,costcenterid,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,obygyVisitId,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate,obgyBillType,billoperationid,datestarting,pricetype,currencyId,knownwayId,travelDriverId,travelBusId,travelPathId,travelTripId,travelTripTypeId,travelTripDateId,totalprodiscount,manage_ex,med_hallmark,pay_rec_no,pay_rec_val,decisionNo,decisionValue,sellToSupplier,supplierbuybillid,shipfrom,shipto,paymethodshipping,whatShippingCost,sellbilltypeclientid,tagids,obgyRefDoc,addressid,couponid,paymenttypeid,paymentdetails) VALUES ('2026-10-22 13:54:43', '06ad9e6d965f65', '40', '129250.00', '150550', '0', '1', '21300', '21300', '0', '21300', '1', '2026-10-22 13:54:43', '', '1', '0', 'الطوخي - عميل', '4', '1', '3', '0', 'الطوخي - عميل', '38', '1313', 'sellbillController', '0','','','','','-1','0','0','0','0','0','0','0','0','0','0','0','0','0000-00-00','0','-1','2026-10-22','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','','0','0','0',''); -- id=1388
UPDATE client SET  clientdebt = '150550', userid = '1' WHERE clientid = '40';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,userSelectedDate,paySerialNo,totalpayments,tagids,file) VALUES ('40','129250.00','21300','0','اضافة فاتورة مبيعات (معدله)','1388', '150550', '2026-10-22 20:46:28', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات (معدله)', '21300', '0', null, '0', null, null,'', '0','1','1','0','1','2026-10-22 13:54:43','0','0','',''); -- id=1630
UPDATE client SET  inUse = 0 where clientid = 40;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+15 where id = 561;
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+3 where id = 7111;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('800','01698', '1388', '130', '1698', '18.00', '850', '15300', '0', '', '0', '2026-10-22 20:46:28', '1698', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','561-15,7111-3,','1','1','0','0','850','15300','0','','0','0.00','0','0','0','0'); -- id=5500
UPDATE sellbilldetail SET  lastbuyprice = 800.00 , meanbuyprice = 800.00, lastbuyprice_withDiscount = 800.00, meanbuyprice_withDiscount = 800.00
        , lastbuyprice_withTax = 800, meanbuyprice_withTax = 800, lastbuyprice_withDiscountAndTax = 800
                where sellbilldetailid = 5500;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1698, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 18, 0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15300, sellCostBuyPrice =sellCostBuyPrice+14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+18
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 15300, 14400, 14400
                    , 14400, 14400, 14400, 14400
                    , 0, 0, 0, 0
                    , 0, 0, 0, 14400, 14400, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+15300, sellCostBuyPrice =sellCostBuyPrice+14400
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+14400, sellCostMeanBuyPrice = sellCostMeanBuyPrice+14400
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+14400, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+14400
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+14400
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+14400
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+14400
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '67', userid = '1', storedetaildate = '2026-10-22 20:46:28' WHERE storedetailid = '2710';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1698', '1', '18', '1', '1388', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '85', '67', '1', '2026-10-22 20:46:28','0','0'); -- id=17249
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+20 where id = 60;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity,proHeight,proWidth,lastbuyprice_withTax,meanbuyprice_withTax,sellbilldetailpriceC,sellbilldetailtotalpriceC,discountvalueC,proSellTrackingSerial,travelBrokerId,categorydiscount,lastbuyprice_withDiscountAndTax,prosellDiscountPer,prosellDiscountPerType,prosellDiscountVal) VALUES ('240','01375', '1388', '91', '1375', '20.00', '300', '6000', '0', '', '0', '2026-10-22 20:46:28', '1375', '0.00', '-1', '1','0.00','','','0','0','0','0','0','0','0','0','','60-20,','1','1','0','0','300','6000','0','','0','0.00','0','0','0','0'); -- id=5501
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
        , lastbuyprice_withTax = 240, meanbuyprice_withTax = 240, lastbuyprice_withDiscountAndTax = 240
                where sellbilldetailid = 5501;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1375, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 20, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0
                        , netQuantity = netQuantity+20
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES (1, '2026-10-22', 6000, 4800, 4800
                    , 4800, 4800, 4800, 4800
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4800, 4800, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+6000, sellCostBuyPrice =sellCostBuyPrice+4800
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+4800, sellCostMeanBuyPrice = sellCostMeanBuyPrice+4800
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+4800, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+4800
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+4800
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+4800
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+4800
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                            , returnSellCostLastBuyPricewithTax = returnSellCostLastBuyPricewithTax+0
                            , returnSellCostMeanBuyPricewithTax = returnSellCostMeanBuyPricewithTax+0;
UPDATE storedetail SET  productquantity = '92', userid = '1', storedetaildate = '2026-10-22 20:46:28' WHERE storedetailid = '1375';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1375', '1', '20', '1', '1388', 'اضافة فاتورة مبيعات (معدله)', 'sellbillController.php', '112', '92', '1', '2026-10-22 20:46:28','0','0'); -- id=17250
UPDATE dailyentry SET totalcreditor = '21300.00', totaldebtor = '21300.00', thedate = '2026-10-22', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:54:43', entryComment = 'اضافة فاتورة مبيعات رقم 1313', fromFlag = '1',related='0',isopeningentry='0',operationId='1313',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1313' WHERE id = '4533';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21300.00', '21300.00', '2026-10-22', '1', '0', '4533', '2026-10-22 20:46:28','تم عكس القيد رقم 4533 ','1','0','0','0','0',''); -- id=4743
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4743', '568', '21300.00', '','0'); -- id=4745
UPDATE accountstree SET name = 'خزنة شروال', customName = 'خزنة شروال', customNameEn = 'خزنة شروال', nameEn = 'خزنة شروال', parent = '40', accountNature = '0', theValue = '1361345', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-06 13:37:54' WHERE id = '568';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4743', '143', '21300.00', '','0'); -- id=4877
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15549165', theOrder = '0', layingOrder = '410101', reportid = '2', listId = '2', notes = '', itemfrom = '0', itemtype = '2', itemtype2 = '0', itemtype3 = 'Income ', userid = '1', del = '0', sysdate = '2022-05-08 23:12:40' WHERE id = '143';
UPDATE dailyentry SET totalcreditor = '19200.00', totaldebtor = '19200.00', thedate = '2026-10-22', userid = '6', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 13:54:43', entryComment = 'اضافة فاتورة مبيعات رقم 1313 - صرف البضاعة من المخزن', fromFlag = '1',related='0',isopeningentry='0',operationId='1313',operationDetailLink='sellbillController.php?do=showDetail&sellbillid=1313' WHERE id = '4534';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '19200.00', '19200.00', '2026-10-22', '1', '0', '4534', '2026-10-22 20:46:28','تم عكس القيد رقم 4534 ','1','0','0','0','0',''); -- id=4744
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4744', '402', '19200.00', '','0'); -- id=4746
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14382679.11', theOrder = '0', layingOrder = '530101', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '1', del = '0', sysdate = '2023-07-25 23:37:18' WHERE id = '402';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4744', '382', '19200.00', '','0'); -- id=4878
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27820868.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '21300', '21300', '2026-10-22', '1', '0', '0', '2026-10-22 20:46:28','اضافة فاتورة مبيعات رقم 1388','1','0',null,'0','1388','sellbillController.php?do=showDetail&sellbillid=1388'); -- id=4745
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4745', '538', '21300', '','0'); -- id=4879
UPDATE accountstree SET name = 'الطوخي - عميل', customName = 'الطوخي - عميل', customNameEn = 'الطوخي - عميل', nameEn = 'الطوخي - عميل', parent = '58', accountNature = '0', theValue = '136205', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = 'Equity ', userid = '1', del = '0', sysdate = '2026-10-01 21:23:05' WHERE id = '538';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4745', '143', '21300', '','0'); -- id=4747
UPDATE accountstree SET name = 'ايرادات المبيعات ', customName = 'ايرادات المبيعات ', customNameEn = 'Revenue of Sales', nameEn = 'Revenue of Sales', parent = '142', accountNature = '1', theValue = '15570465', 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 ( '19200', '19200', '2026-10-22', '1', '0', '0', '2026-10-22 20:46:28','اضافة فاتورة مبيعات رقم 1388 - صرف البضاعة من المخزن','1','0',null,'0','1388','sellbillController.php?do=showDetail&sellbillid=1388'); -- id=4746
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4746', '402', '19200', '','0'); -- id=4880
UPDATE accountstree SET name = 'تكلفة التشغيل', customName = 'تكلفة التشغيل', customNameEn = '', nameEn = '', parent = '160', accountNature = '0', theValue = '14401879.11', 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 ('4746', '382', '19200', '','0'); -- id=4748
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27801668.09', 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='4745,0,4746' where sellbillid=1388;
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice,sellCostLastBuyPricewithTax,sellCostMeanBuyPricewithTax,returnSellCostLastBuyPricewithTax,returnSellCostMeanBuyPricewithTax)
                    VALUES ('2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21300, sellCostBuyPrice =sellCostBuyPrice+19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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 (40, '2026-10-22', 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200
                    , 0, 0, 0, 0
                    , 0, 0, 0 ,19200, 19200, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+21300, sellCostBuyPrice =sellCostBuyPrice+19200
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19200, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19200
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19200, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19200
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+19200
                            , sellCostLastBuyPricewithTax = sellCostLastBuyPricewithTax+19200
                            , sellCostMeanBuyPricewithTax = sellCostMeanBuyPricewithTax+19200
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+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, 21300, 19200, 19200
                    , 19200, 19200, 19200, 19200, 19200, 19200)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+21300, netSellCostBuyPrice = netSellCostBuyPrice+19200
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19200
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19200
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+19200
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+19200
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+19200
                , netSellCostLastBuyPricewithTax = netSellCostLastBuyPricewithTax+19200
                , netSellCostMeanBuyPricewithTax = netSellCostMeanBuyPricewithTax+19200;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill update end - new add end - with oldid = 1313 and newid=1388 and controlname = sellbillController
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:16:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 20:46:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 20:46:28', '1', 'editprint', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=editprint&id=1388'); -- id=19162
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:17:28";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:47:28", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:47:28', '1', '', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php'); -- id=19163
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:17:54";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:47:54", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:47:54', '1', 'autosave', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=19164
UPDATE storedetail SET  productquantity = '6', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '6', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية لم يتغير', 'inventoryController.php', '6', '6', '1', '2026-10-22','0','0'); -- id=17251
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:18:11";
UPDATE user SET loginip = "196.157.65.169", lastactivetime = "2026-10-22 20:48:11", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('inventoryController.php', '2026-10-22 20:48:11', '1', 'autosave', '196.157.65.169', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/inventoryController.php?do=autosave'); -- id=19165
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '1377';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1377', '1', '6', '1', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالنقص', 'inventoryController.php', '6', '0', '1', '2026-10-22','0','0'); -- id=17252
BEGIN;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '1500', '1500', '2026-10-22', '1', '0', '0', '2026-10-22 20:48:11','اعادة جرد للمنتج : (جبردين سيفن ار/سيفن ار) فى مخزن : (المخزن الرئيسي) بالكمية : 0','1','0',null,'0','17252','inventoryController.php?do=details&id=17252'); -- id=4747
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4747', '188', '1500', '','0'); -- id=4881
UPDATE accountstree SET name = 'عجز وزيادة المخزون', customName = 'عجز وزيادة المخزون', customNameEn = '', nameEn = '', parent = '159', accountNature = '0', theValue = '-3250130', theOrder = '0', layingOrder = '5302', reportid = '2', listId = '2', notes = '', itemfrom = '1', itemtype = '5', itemtype2 = '0', itemtype3 = '', userid = '-1', del = '0', sysdate = '2023-07-11 01:08:03' WHERE id = '188';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4747', '382', '1500', '','0'); -- id=4749
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27800168.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:43:23";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 21:13:23", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 21:13:23', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19166

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada498a06409
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada498a06409 and sellbillId = 1389 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:43:24";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 21:13:24", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 21:13:24', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19167
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:47:12";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:51:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 21:21:22", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 21:21:22', '2', 'addAndRetuen', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addAndRetuen'); -- id=19168

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06ada52442389c
-- ----------------------------------------------------------------------------------------------------

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

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06ada52442389c and sellbillId = 1390 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 17:51:22";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 21:21:22", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 21:21:22', '2', 'addsellBill', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19169
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:15:45";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 21:45:45", deviceType = "DESKTOP" WHERE userid = 2;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('savedailyController.php', '2026-10-22 21:45:45', '2', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/savedailyController.php'); -- id=19170
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:33:15";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:33:23";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:03:23", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 22:03:23', '1', '', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19171
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:33:23";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 22:03:23', '1', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19172
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:33:33";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:03:33", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:03:33', '1', '', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19173
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:33:45";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:03:45", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:03:45', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php?do=show'); -- id=19174
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:35:08";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:05:08", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:05:08', '1', '', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=19175
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:36:00";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:06:00", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:06:00', '1', 'add2', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=19176
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('دارك','2026-10-22','','215', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=219
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (219, 1,'2026-10-22 22:06:00',1)
                ON DUPLICATE KEY UPDATE catid = 219, edited = 1, sysdate = '2026-10-22 22:06:00', userid = 1; -- id=234
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '219', '1', '2026-10-22', '1', '0'); -- id=107
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:36:01";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:06:01", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:06:01', '1', 'sucess', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=19177
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:36:03";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:06:03", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:06:03', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=19178
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:36:24";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:06:24", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:06:24', '1', '', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19179
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:37:31";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:07:31", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:07:31', '1', 'add', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=19180
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('ترينج اديداس دارك','','219','690','740','0','0','2026-10-22','0','1','0','','0','0','0','0','0','690','690','690','690','690','0','7.25','0','0','.','0','0','0','690','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','690','690','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','690','0','0','0','0','0','0','','','0','0','0','0'); -- id=2475
UPDATE product SET productName = 'ترينج اديداس دارك', productDescription = '', productCatId = '219', productBuyPrice = '690', productSellAllPrice = '740', productSellUnitPrice = '0', productSellHalfPrice = '0', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02475',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '690',lastbuyprice_withDiscount = '690',meanbuyprice = '690',meanbuyprice_withDiscount = '690' , productbuypricereal = '690' , buypricereal_precentage = '0' , buytotal_precentage = '7.25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='690',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='690',meanbuyprice_withTax='690',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='690',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2475';
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', '2475', '1.00', '2026-10-22', '1', '0','0247501','740','0','0','690','','0','0','0','0','0','0','0','0','0','0'); -- id=2475
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2475', '1', '0', '1', '2026-10-22'); -- id=3870
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2475', '1', '0', '0', '2475', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-22','0','0'); -- id=17255
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2475, 1,'2026-10-22 22:07:31',1)
                ON DUPLICATE KEY UPDATE productid = 2475, edited = 1, sysdate = '2026-10-22 22:07:31', userid = 1; -- id=3699
UPDATE product SET productName = 'ترينج اديداس دارك', productDescription = '', productCatId = '219', productBuyPrice = '690.00', productSellAllPrice = '740.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02475',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '690',lastbuyprice_withDiscount = '690',meanbuyprice = '690',meanbuyprice_withDiscount = '690' , productbuypricereal = '690' , buypricereal_precentage = '0' , buytotal_precentage = '7.25' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='690',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='690',meanbuyprice_withTax='690',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='690',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2475';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:37:33";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:07:33", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:07:33', '1', '', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19181
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:37:36";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:07:36", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:07:36', '1', 'bill', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=19182
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:37:37";
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:38:29";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:08:29", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:08:29', '1', 'add', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=19183
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 ('06ada5ef85f297', '2026-10-22 22:07:36', '150', '-103755.00', '-62355', '0', '0', '41400.00',  '41400.00', '0', '41400', '1', '2026-10-22 22:08:29', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=359
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 ('02475', '359', '219', '2475', '60', '690', '41400.00', '0', '', '2026-10-22 22:08:29', '2475','','','0','0','0','0','0',null,'690','41400','0','0','0','0','0','0','0','0','1'); -- id=1885
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 22:07:36', 1, 2475, 0, 0
                    , 690, 60, 0, 0, 1, '2026-10-22 22:08:29')
                ON DUPLICATE KEY UPDATE buyprice = 690,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 22:08:29' ; -- id=7242
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2475', '690', '60', '0', 'buyBillController.php', '1885', '', '0', '0'); -- id=1401
UPDATE product SET  productBuyPrice = "690" WHERE productId = 2475 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1885 ;
UPDATE product SET productName = 'ترينج اديداس دارك', productDescription = '', productCatId = '219', productBuyPrice = '690.00', productSellAllPrice = '740.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02475',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '690',lastbuyprice_withDiscount = '690',meanbuyprice = '690',meanbuyprice_withDiscount = '690' , productbuypricereal = '690.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.25' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='690',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='690',meanbuyprice_withTax='690',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='690',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2475';
UPDATE buybilldetail SET  lastbuyprice = 690 , meanbuyprice = 690, lastbuyprice_withDiscount = 690, meanbuyprice_withDiscount = 690
        , lastbuyprice_withTax = 690, meanbuyprice_withTax = 690, lastbuyprice_withDiscountAndTax = 690
                where buybilldetailid = 1885;
UPDATE productunit SET proUnitBuyPrice  = 690 * productnumber WHERE productid = 2475;
UPDATE storedetail SET  productquantity = '60', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3870';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2475', '1', '60', '0', '359', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '1', '2026-10-22 22:07:36','0','0'); -- id=17256
UPDATE supplier SET  suppliercurrentDebt = '-62355',suppliercurrentDebtInCurrency= '-62355' , userid = '1', supplierdate = '2026-10-22 22:08:29'   WHERE supplierid = '150';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('150', '-103755.00', '41400', '0', 'اضافة فاتورة مشتريات', '359', '-62355', '2026-10-22 22:07:36', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','41400','1','-103755','41400','-62355','0',''); -- id=929
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '41400', '41400', '2026-10-22', '1', '0', '0', '2026-10-22 22:08:29','اضافة فاتورة مشتريات رقم 359','1','0',null,'0','359','buyBillController.php?do=details&id=359'); -- id=4752
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4752', '382', '41400', '','0'); -- id=4887
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27832918.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4752', '633', '41400', '','0'); -- id=4754
UPDATE accountstree SET name = 'دارك - مورد', customName = 'دارك - مورد', customNameEn = 'دارك - مورد', nameEn = 'دارك - مورد', parent = '81', accountNature = '1', theValue = '-62355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:38:12' WHERE id = '633';
update buybill set dailyentryid='4752,0' where buybillid=359;
COMMIT;
UPDATE product SET overAllAveragePrice = 690 WHERE productId = 2475;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:38:29";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:08:29", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:08:29', '1', 'editprint', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=359'); -- id=19184
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:38:43";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:08:43", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-22 22:08:43', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=show'); -- id=19185
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:38:47";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:08:47", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-22 22:08:47', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=show'); -- id=19186
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:39:04";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:09:04", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:09:04', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19187
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:39:10";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:09:10", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:09:10', '1', 'editbill', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=359'); -- id=19188
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:39:21";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:09:21", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:09:21', '1', 'update', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=update'); -- id=19189
BEGIN;
UPDATE costcenterdetail SET del = 1 WHERE type in( 3) and  modelid = 359;
UPDATE buybill SET  buybillsysdate = '2026-10-22 22:09:21', userid = '1',delbyuserid = '1', conditions = '1' WHERE buybillid = '359';
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 22:07:36', 1, 2475, 0, 0
                    , 690, 60, 0, 0, 1, '2026-10-22 22:09:21')
                ON DUPLICATE KEY UPDATE buyQuantity =buyQuantity-60, sellQuantity = sellQuantity-0,
                        del = 0,userid = 1,sysDate = '2026-10-22 22:09:21' ; -- id=7242
UPDATE buybilldetail SET  lastbuyprice = 690.00 , meanbuyprice = 690.00, lastbuyprice_withDiscount = 690.00, meanbuyprice_withDiscount = 690.00
        , lastbuyprice_withTax = 690.00, meanbuyprice_withTax = 690.00, lastbuyprice_withDiscountAndTax = 690.00
                where buybilldetailid = 1885;
UPDATE product SET productName = 'ترينج اديداس دارك', productDescription = '', productCatId = '219', productBuyPrice = '690.00', productSellAllPrice = '740.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02475',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '690',lastbuyprice_withDiscount = '0',meanbuyprice = '690.00',meanbuyprice_withDiscount = '690' , productbuypricereal = '690.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.25' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='690',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='690',meanbuyprice_withTax='0',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='0',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2475';
UPDATE productunit SET proUnitBuyPrice  = 690 * productnumber WHERE productid = 2475;
UPDATE storedetail SET  productquantity = '0', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3870';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2475', '1', '60', '1', '359', 'حذف فاتورة مشتريات - للتعديل', 'buyBillController.php', '60', '0', '1', '2026-10-22 22:07:36','0','0'); -- id=17257
UPDATE supplier SET  suppliercurrentDebt = '-103755',suppliercurrentDebtInCurrency= '-103755' , userid = '1', supplierdate = '2026-10-22 22:09:21'   WHERE supplierid = '150';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('150', '-62355.00', '41400.00', '1', 'حذف فاتورة مشتريات - للتعديل', '359', '-103755', '2026-10-22 22:07:36', '1', 'buyBillController.php', 'حذف فاتورة مشتريات - للتعديل', '0','', '0','1','1','41400','1','-62355','41400','-103755','0',''); -- id=930
UPDATE productserial SET del = 1
		 WHERE billid = 359;
INSERT INTO buybill (buybillSerial, buybilldate, buybillsupplierid, buybilltotaldeptbefor, buybilltotaldeptafter, buybilldiscount, buybilldiscountrype, buybilltotalbill, buybillaftertotalbill, buybilltotalpayed, buybillfinalbill, buybillstoreid, buybillsysdate,comment, userid, conditions, buybillclientname, buybillsaveid, buybilldirectpayment, billnameid,deletedbuyid,controlname,payedtax,costcenterid,currencyId,taxOfDiscountPer,taxOfDiscountVal,files,client,totalBuyDiscountVal,webApiId,buybilladdition,buybilladditiontrype,tagids) VALUES ('06ada5ef85f297', '2026-10-22 22:07:36', '150', '-103755.00', '-62355', '0', '0', '41400.00', '41400.00', '0.00', '41400', '2', '2026-10-22 22:09:21', '', '1', '0', '', '1', '1','1','359','buyBillController.php','0.00','-1','1','0','0','.','0','0','0','0','0','0'); -- id=360
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 ('02475', '360', '219', '2475', '60.00', '690', '41400.00', '0.00', '', '2026-10-22 22:09:21', '2475','','','0','0','0','0','0',null,'690','41400','0','0','0','0','0','0','0','0','2'); -- id=1886
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 22:07:36', 2, 2475, 0, 0
                    , 690, 60, 0, 0, 1, '2026-10-22 22:09:21')
                ON DUPLICATE KEY UPDATE buyprice = 690,
                        buyQuantity =buyQuantity+60, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 22:09:21' ; -- id=7244
UPDATE product SET  productBuyPrice = "690" WHERE productId = 2475 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1886 ;
UPDATE product SET productName = 'ترينج اديداس دارك', productDescription = '', productCatId = '219', productBuyPrice = '690.00', productSellAllPrice = '740.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '02475',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '690',lastbuyprice_withDiscount = '690',meanbuyprice = '690',meanbuyprice_withDiscount = '690' , productbuypricereal = '690.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '7.25' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='690',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='690',meanbuyprice_withTax='345',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='690',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2475';
UPDATE buybilldetail SET  lastbuyprice = 690 , meanbuyprice = 690, lastbuyprice_withDiscount = 690, meanbuyprice_withDiscount = 690
        , lastbuyprice_withTax = 690, meanbuyprice_withTax = 345, lastbuyprice_withDiscountAndTax = 690
                where buybilldetailid = 1886;
UPDATE productunit SET proUnitBuyPrice  = 690 * productnumber WHERE productid = 2475;
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2475', '2', '60', '1', '2026-10-22 22:07:36'); -- id=3871
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2475', '2', '60', '0', '360', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '60', '1', '2026-10-22 22:07:36','0','0'); -- id=17258
DELETE FROM productserial WHERE billid = 359
		and type =0 
		;
UPDATE supplier SET  suppliercurrentDebt = '-62355',suppliercurrentDebtInCurrency= '-62355' , userid = '1', supplierdate = '2026-10-22 22:09:21'   WHERE supplierid = '150';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('150', '-103755.00', '41400', '0', 'اضافة فاتورة مشتريات', '360', '-62355', '2026-10-22 22:09:21', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','41400','1','-103755','41400','-62355','0',''); -- id=931
UPDATE dailyentry SET totalcreditor = '41400.00', totaldebtor = '41400.00', thedate = '2026-10-22', userid = '1', `condition` = '0', reverseofid = '-10', dDateTime = '2026-10-22 22:08:29', entryComment = 'اضافة فاتورة مشتريات رقم 359', fromFlag = '1',related='0',isopeningentry='0',operationId='359',operationDetailLink='buyBillController.php?do=details&id=359' WHERE id = '4752';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '41400.00', '41400.00', '2026-10-22', '1', '0', '4752', '2026-10-22 22:09:21','تم عكس القيد رقم 4752 ','1','0','0','0','0',''); -- id=4753
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4753', '382', '41400.00', '','0'); -- id=4755
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '27791518.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4753', '633', '41400.00', '','0'); -- id=4888
UPDATE accountstree SET name = 'دارك - مورد', customName = 'دارك - مورد', customNameEn = 'دارك - مورد', nameEn = 'دارك - مورد', parent = '81', accountNature = '1', theValue = '-103755', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:38:12' WHERE id = '633';
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '41400', '41400', '2026-10-22', '1', '0', '0', '2026-10-22 22:09:21','اضافة فاتورة مشتريات رقم 360','1','0',null,'0','360','buyBillController.php?do=details&id=360'); -- id=4754
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4754', '492', '41400', '','0'); -- id=4889
UPDATE accountstree SET name = 'مخزن المحل', customName = 'مخزن المحل', customNameEn = 'مخزن المحل', nameEn = 'مخزن المحل', parent = '49', accountNature = '0', theValue = '1495061', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-09-29 19:38:59' WHERE id = '492';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4754', '633', '41400', '','0'); -- id=4756
UPDATE accountstree SET name = 'دارك - مورد', customName = 'دارك - مورد', customNameEn = 'دارك - مورد', nameEn = 'دارك - مورد', parent = '81', accountNature = '1', theValue = '-62355', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-09 21:38:12' WHERE id = '633';
update buybill set dailyentryid='4754,0' where buybillid=360;
UPDATE product SET overAllAveragePrice = 690 WHERE productId = 2475;;
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:39:22";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:09:22", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:09:22', '1', 'editprint', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=360'); -- id=19190
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:40:14";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:10:14", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 22:10:14', '1', 'addsellBill', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19191
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:40:37";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:10:37", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:10:37', '1', 'editprint', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=360'); -- id=19192
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:40:38";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:10:38", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:10:38', '1', 'editbill', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editbill&id=359'); -- id=19193
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:40:39";
UPDATE user SET loginip = "105.192.147.19", lastactivetime = "2026-10-22 22:10:39", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:10:39', '1', 'show', '105.192.147.19', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=show'); -- id=19194
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:48:28";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:18:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 22:18:28', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19195
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:48:29";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 22:18:29', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19196
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:48:29";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:18:29", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 22:18:29', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19197
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:48:29";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 22:18:30', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19198
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:48:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:18:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:18:36', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19199
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:49:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:19:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:19:10', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19200
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:52:56";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:53:12";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:23:12", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 22:23:12', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19201
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:53:13";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 22:23:13', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19202
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:53:15";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:23:15", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:23:15', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19203
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:57:24";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:27:24", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('returnBuyBillController.php', '2026-10-22 22:27:24', '1', 'show', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/returnBuyBillController.php?do=show'); -- id=19204
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:57:42";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:27:42", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:27:42', '1', '', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=19205
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:57:56";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:27:56", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:27:56', '1', '', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php'); -- id=19206
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:58:20";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:28:20", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:28:20', '1', 'add2', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=add2'); -- id=19207
INSERT INTO productcat (productCatName, productCatDate, productCatDescription, productCatParent, userId, conditions, selldiscount, buydiscount, discounttype,isOptic , buytotal , buyhalf , buypart ,buypricereal,opticServices,logo,inMenu,stopNegativeSale,catExcelid,webApiId,obygyInvestigationCatId,price4,price5,price6,price7,price8,price9,price10,price11,price12,price13) VALUES ('فولكانو تي شيرت','2026-10-22','','93', '1','0', '0', '0', '-1', '0', '0', '0', '0','0','','.','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); -- id=220
INSERT INTO onlinetempcategory (catid, edited, sysdate, userid)
                VALUES (220, 1,'2026-10-22 22:28:20',1)
                ON DUPLICATE KEY UPDATE catid = 220, edited = 1, sysdate = '2026-10-22 22:28:20', userid = 1; -- id=235
INSERT INTO productcatunit (unitid, productcatid, productnumber, productcatunitdate, userid, conditions) VALUES ('1', '220', '1', '2026-10-22', '1', '0'); -- id=108
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:58:20";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:28:20", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:28:20', '1', 'sucess', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=sucess'); -- id=19208
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:58:22";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:28:22", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productCatController.php', '2026-10-22 22:28:22', '1', 'show', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productCatController.php?do=show'); -- id=19209
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:58:24";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:28:24", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:28:24', '1', '', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19210
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:59:34";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:29:34", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:29:34', '1', 'add', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php?do=add'); -- id=19211
BEGIN;
INSERT INTO product (productName,productDescription,productCatId,productBuyPrice,productSellAllPrice,productSellUnitPrice,productSellHalfPrice,productDate,conditions,userId,limitamount,parcode,type,expireDate,dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount,productbuypricereal,buypricereal_precentage,buytotal_precentage,buyhalf_precentage,buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId,runquery,weightedDiscount,sortby,obygyInvestigationId,TypeOfBarcodeInTax,itemsymbol,barcodeInTax,productNameE,partNumber,vehicleType,company,weight,origin,hscode,power,ProductionDate,expiry,procode,lastbuyprice_withTax,meanbuyprice_withTax,price4,price5,price6,price7,price8,clientid,grantduration,onlinepro,minappearonline,selladdpercent,selldiscountpercent,buydiscountpercent,onlinecatid,sellpercenttype,searchfiltersid,lastbuyprice_withDiscountAndTax,price9,price10,price11,price12,price13,productCatIdOnline,tagids,productDescriptionE,discountType,discount,discountRatio,priceAfterDiscount) VALUES ('دبل زنط فولكانو','','220','260','275','0','0','2026-10-22','0','1','0','111222','0','0','0','0','0','260','260','260','260','260','0','5.77','0','0','.','0','0','0','260','0','','','0','0','0','','0','0','0','GS1','','','','0','0','0','0','','0','0','','0','','260','260','0','0','0','0','0','0','0','0','0','0','0','0','-1','0','','260','0','0','0','0','0','0','','','0','0','0','0'); -- id=2476
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', '2476', '1.00', '2026-10-22', '1', '0','0247601','275','0','0','260','','0','0','0','0','0','0','0','0','0','0'); -- id=2476
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('2476', '1', '0', '1', '2026-10-22'); -- id=3872
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2476', '1', '0', '0', '2476', 'إضافة منتج', 'productController.php', '0', '0', '1', '2026-10-22','0','0'); -- id=17259
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (2476, 1,'2026-10-22 22:29:34',1)
                ON DUPLICATE KEY UPDATE productid = 2476, edited = 1, sysdate = '2026-10-22 22:29:34', userid = 1; -- id=3700
UPDATE product SET productName = 'دبل زنط فولكانو', productDescription = '', productCatId = '220', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '111222',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260' , buypricereal_precentage = '0' , buytotal_precentage = '5.77' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2476';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:59:35";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:29:35", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:29:35', '1', '', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/productController.php'); -- id=19212
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 18:59:43";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:29:43", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:29:43', '1', 'bill', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=bill&billnameid=1'); -- id=19213
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:01:19";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:31:19", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:31:19', '1', 'add', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=add'); -- id=19214
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 ('06ada6427b6ef5', '2026-10-22 22:29:43', '133', '-25200000.00', '-24732000', '0', '0', '468000.00',  '468000.00', '0', '468000', '1', '2026-10-22 22:31:19', '', '1', '0', '', '1','1','1','0.00','-1','0','0','1','0','0','.','0','0','0','0','0',''); -- id=361
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 ('111222', '361', '220', '2476', '1800', '260', '468000.00', '0', '', '2026-10-22 22:31:19', '2476','','','0','0','0','0','0',null,'260','468000','0','0','0','0','0','0','0','0','1'); -- id=1887
INSERT INTO buypriceshistorybook (theDate, storeId, productid, sizeid, colorid, buyprice, buyQuantity, sellQuantity, del, userid, sysDate)
                    VALUES ('2026-10-22 22:29:43', 1, 2476, 0, 0
                    , 260, 1800, 0, 0, 1, '2026-10-22 22:31:19')
                ON DUPLICATE KEY UPDATE buyprice = 260,
                        buyQuantity =buyQuantity+1800, sellQuantity = sellQuantity+0,
                        del = 0,userid = 1,sysDate = '2026-10-22 22:31:19' ; -- id=7245
INSERT INTO entryproductspurchased (productid, price, productquantity, soldquantity, tablename, modelid, expirationDate, priority, del) VALUES ('2476', '260', '1800', '0', 'buyBillController.php', '1887', '', '0', '0'); -- id=1402
UPDATE product SET  productBuyPrice = "260" WHERE productId = 2476 ;
UPDATE buybilldetail SET  quantitybefore = 0 WHERE buybilldetailid = 1887 ;
UPDATE product SET productName = 'دبل زنط فولكانو', productDescription = '', productCatId = '220', productBuyPrice = '260.00', productSellAllPrice = '275.00', productSellUnitPrice = '0.00', productSellHalfPrice = '0.00', productDate = '2026-10-22', conditions = '0', userId = '1', limitamount = '0', parcode = '111222',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '260',lastbuyprice_withDiscount = '260',meanbuyprice = '260',meanbuyprice_withDiscount = '260' , productbuypricereal = '260.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '5.77' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',overAllAveragePrice='260',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0',webApiId='0',weightedDiscount='0',sortby='0',TypeOfBarcodeInTax='GS1',itemsymbol='',barcodeInTax='',productNameE='',partNumber='0',vehicleType='0',company='0',weight='0',origin='',hscode='0',power='0',ProductionDate='',expiry='0',procode='',lastbuyprice_withTax='260',meanbuyprice_withTax='260',price4='0',price5='0',price6='0',price7='0',price8='0',clientid='0',grantduration='0',onlinepro='0',minappearonline='0',selladdpercent='0',selldiscountpercent='0',buydiscountpercent='0',onlinecatid='-1',sellpercenttype='0',searchfiltersid='',lastbuyprice_withDiscountAndTax='260',price9='0',price10='0',price11='0',price12='0',price13='0',productCatIdOnline='0',tagids='',productDescriptionE='', discountType = '0', discount = '0', discountRatio = '0',priceAfterDiscount = '0' WHERE productId = '2476';
UPDATE buybilldetail SET  lastbuyprice = 260 , meanbuyprice = 260, lastbuyprice_withDiscount = 260, meanbuyprice_withDiscount = 260
        , lastbuyprice_withTax = 260, meanbuyprice_withTax = 260, lastbuyprice_withDiscountAndTax = 260
                where buybilldetailid = 1887;
UPDATE productunit SET proUnitBuyPrice  = 260 * productnumber WHERE productid = 2476;
UPDATE storedetail SET  productquantity = '1800', userid = '1', storedetaildate = '2026-10-22' WHERE storedetailid = '3872';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('2476', '1', '1800', '0', '361', 'اضافة فاتورة مشتريات', 'buyBillController.php', '0', '1800', '1', '2026-10-22 22:29:43','0','0'); -- id=17260
UPDATE supplier SET  suppliercurrentDebt = '-24732000',suppliercurrentDebtInCurrency= '-24732000' , userid = '1', supplierdate = '2026-10-22 22:31:19'   WHERE supplierid = '133';
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor,debtchangbeforeInSupplierCurrency,debtchangamountInSupplierCurrency,debtchangafterInSupplierCurrency,paySerialNo,tagids) VALUES ('133', '-25200000.00', '468000', '0', 'اضافة فاتورة مشتريات', '361', '-24732000', '2026-10-22 22:29:43', '1', 'buyBillController.php', 'اضافة فاتورة مشتريات', '0','', '0','1','1','468000','1','-25200000','468000','-24732000','0',''); -- id=932
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid,isopeningentry,operationId,operationDetailLink) VALUES ( '468000', '468000', '2026-10-22', '1', '0', '0', '2026-10-22 22:31:19','اضافة فاتورة مشتريات رقم 361','1','0',null,'0','361','buyBillController.php?do=details&id=361'); -- id=4755
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4755', '382', '468000', '','0'); -- id=4890
UPDATE accountstree SET name = 'مخزن1', customName = 'المخزن الرئيسي', customNameEn = 'مخزن1', nameEn = 'مخزن1', parent = '49', accountNature = '0', theValue = '28259518.09', theOrder = '0', layingOrder = '120202', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '3', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2022-05-08 23:13:11' WHERE id = '382';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('4755', '616', '468000', '','0'); -- id=4757
UPDATE accountstree SET name = 'فولكانو تيشيرت', customName = 'فولكانو تيشيرت', customNameEn = 'فولكانو تيشيرت', nameEn = 'فولكانو تيشيرت', parent = '81', accountNature = '1', theValue = '-24732000', theOrder = '0', layingOrder = '', reportid = '1', listId = '1', notes = '', itemfrom = '0', itemtype = '1', itemtype2 = '1', itemtype3 = '', userid = '1', del = '0', sysdate = '2026-10-08 21:57:44' WHERE id = '616';
update buybill set dailyentryid='4755,0' where buybillid=361;
COMMIT;
UPDATE product SET overAllAveragePrice = 260 WHERE productId = 2476;;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:01:19";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:31:19", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('buyBillController.php', '2026-10-22 22:31:19', '1', 'editprint', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/buyBillController.php?do=editprint&id=361'); -- id=19215
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:01:36";
UPDATE user SET loginip = "197.37.185.142", lastactivetime = "2026-10-22 22:31:36", deviceType = "MOBILE" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('sellbillController.php', '2026-10-22 22:31:36', '1', 'addsellBill', '197.37.185.142', '', 'MOBILE','https://elaraby.gt4it.com/erp/controllers/sellbillController.php?do=addsellBill&billnameid=3'); -- id=19216
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:02:47";
update user set blockedByLimits = 0;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties; -- id=0
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties; -- id=0
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:03:10";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:33:10", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('index.php', '2026-10-22 22:33:10', '7', '', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/index.php'); -- id=19217
UPDATE product SET lastbuyprice=productBuyPrice,lastbuyprice_withDiscount=productBuyPrice,meanbuyprice=productBuyPrice,meanbuyprice_withDiscount=productBuyPrice where lastbuyprice is null;
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:03:10";
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('playStationCardController.php', '2026-10-22 22:33:10', '7', 'handleExpiredCards', '51.89.20.165', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/playStationCardController.php?do=handleExpiredCards'); -- id=19218
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:03:13";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:33:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:33:13', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19219
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:04:36";
UPDATE user SET loginip = "41.42.136.168", lastactivetime = "2026-10-22 22:34:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType,completeURL) VALUES ('productController.php', '2026-10-22 22:34:36', '7', 'showbarcode', '41.42.136.168', '', 'DESKTOP','https://elaraby.gt4it.com/erp/controllers/productController.php?do=showbarcode'); -- id=19220
UPDATE user SET loginip = "" WHERE lastactivetime < "2026-10-22 19:06:50";
