INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:18";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 11:37:19', '1', '', '156.210.56.186', '', 'DESKTOP');
UPDATE programsettings SET companyname = 'GT4', address = 'المنصورة', specializtion = 'jh', phone = '01002019235', faxnumber = '0502232923', email = 'mrabozied@gt4it.com', website = 'www.gt4host.com', logo = '471502e62c0be89a8d90663028144a83.jpg', roundnumbers = '0', saveprinting = '1', deptprinting = '0', printingpapersize = '0', userid = '1', showPreviousPrice = '0', parcode = '0', priceing = '0', lastprice = '0', searchvalue = '1', updateproductprice = '0', allowfinsldelete = '0', updateclientprice = '0', `partition` = '0', taxcard = '332', commercialregistration = '3213123312', costcenter = '1', clinic = '1', workshop = '1', transport = '1', manufacturing = '0', masterCopy = '0' , dailyentrydate = '2020-04-18' ,updatefiledate = '2023-02-07',workerbetweenstores = '1',workshoptimeout = '24',drivertimeout = '3',currancy = 'جنيه',serial='9c2d4cf4cf5d4e24d5070164705832c3a5d1287f641a2960e48e04ae57a2ad0a5441322ca7cf34efd63003fdb348adbd0b61197c7c87d8dd5bc298c352482bc6',allowdateedit = '0', clientcode = '1' ,clientserial = '1',timezone = 'Africa/Cairo' , expiredate ='1' , production ='1' , description='1' , service ='1' , 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 = '1', isCafe = '0' ,isRestaurent = '0' ,productDays = '0',thereIsRestTax = '0',restTaxVal = '0',restPrintLang = '0',taxNameFlag = '0',parcodeDigits = '5' ,specializedParcodeDigits = '7', clientDefaultDebtLimit = '10000' , clientDefaultDebtLimitControl = '0',usedParcode = '0' ,productbycodeimage = '' ,commentClient='تعليق على العميل ',Inventoryevaluation='first',Profitevaluation='first' , delivery='-2',premiums = '0',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 = ',-2,-1,1,',earlyrepayment = '0',visaPay = '0',headerPrint='',headerPrintSand='',printSand='0',makeDailyEntry='0',clientShowTawla='0',billRest='1',suppIsClientToo='0',isCarBill='0',expensesproduct='1',projectshownew='1',showparcode='0',changeBuyPriceChangeSellInBuyBillCtrl = '0',changeBuyPriceChangeSellInProductCtrl = '0',inventoryvaluation = '1',showBillCollectionSearch='0' WHERE programsettingsid = '1';
UPDATE product
                JOIN (
                       select productingredients.productId
                              ,sum(productnumber * quantity * productBuyPrice) as productBuyPrice
                              ,sum(productnumber * quantity * lastbuyprice) as lastbuyprice
                              ,sum(productnumber * quantity * lastbuyprice_withDiscount) as lastbuyprice_withDiscount
                              ,sum(productnumber * quantity * meanbuyprice) as meanbuyprice
                              ,sum(productnumber * quantity * meanbuyprice_withDiscount) as meanbuyprice_withDiscount
                              ,sum(productnumber * quantity * overAllAveragePrice) as overAllAveragePrice
                      from product
                      join productingredients on product.productId = productingredients.ingridientId
                      join productunit on productunit.productunitid = productingredients.unitId
                      group by productingredients.productId
                    ) as ingridientPrice ON ingridientPrice.productId =  product.productId
                SET product.productBuyPrice = ingridientPrice.productBuyPrice,
                        product.lastbuyprice = ingridientPrice.lastbuyprice,
                    product.lastbuyprice_withDiscount = ingridientPrice.lastbuyprice_withDiscount,
                    product.meanbuyprice = ingridientPrice.meanbuyprice,
                    product.meanbuyprice_withDiscount = ingridientPrice.meanbuyprice_withDiscount,
                    product.overAllAveragePrice = ingridientPrice.overAllAveragePrice;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:20";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:32";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 11:37:32', '1', '', '156.210.56.186', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:33";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 11:37:33', '1', '', '156.210.56.186', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:51";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 11:37:51', '1', 'add', '156.210.56.186', '', 'DESKTOP');
BEGIN;
INSERT INTO transfermoney (saveidfrom, saveidto, transfermoneyvalue, transfermoneydate, userid, conditions, dailyentryid , comment) VALUES ('8','9', '2535', '2023-02-07', '1', '0', '0','');
UPDATE save SET  savecurrentvalue = '0',  userid = '1' WHERE saveid = '8';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2535.00','2535', '1', '8', 'تحويل امول الى الخزنة  [ الشيخ وليد ] ', '441', '0', '2023-02-07 11:37:51', '1',  'transfermoneyController.php','0','');
UPDATE save SET  savecurrentvalue = '5290110',  userid = '1' WHERE saveid = '9';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5287575.00','2535', '0', '9', 'تحويل امول من الخزنة  [ خزينة محل ابو كريم ] ', '441', '5290110', '2023-02-07 11:37:51', '1',  'transfermoneyController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '2535', '2535', '2023-02-07', '1', '0', '0', '2023-02-07 11:37:51','اضافة تحويل من خزينة محل ابو كريم الى الشيخ وليد','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6140', '156', '2535', '','0');
UPDATE accountstree SET name = 'الشيخ وليد', customName = 'الشيخ وليد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-09', itemtype2 = '1', theValue = '5290110', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '156';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6140', '142', '2535', '','0');
UPDATE accountstree SET name = 'خزينة محل ابو كريم', customName = 'خزينة محل ابو كريم', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-1004443', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '142';
UPDATE transfermoney SET saveidfrom = '8', saveidto = '9', transfermoneyvalue = '2535.00', transfermoneydate = '2023-02-07', userid = '1', conditions = '0' , dailyentryid = '6140' , comment = '' WHERE transfermoneyid = '441';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:52";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 11:37:52', '1', 'sucess', '156.210.56.186', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:54";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 11:37:54', '1', 'show', '156.210.56.186', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 08:07:57";
UPDATE user SET loginip = "156.210.56.186", lastactivetime = "2023-02-07 11:37:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 11:37:57', '1', 'addsellBill', '156.210.56.186', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 09:55:32";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 13:25:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 13:25:32', '7', '', '197.192.234.232', '', 'DESKTOP');
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 < "2023-02-07 09:55:32";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 09:55:35";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 13:25:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 13:25:35', '7', 'addsellBill', '197.192.234.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 09:59:41";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 13:29:41", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 13:29:41', '7', 'addsellBill', '197.192.234.232', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 10:00:30";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 13:30:30", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 13:30:30', '7', '', '197.192.234.232', '', 'DESKTOP');
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 < "2023-02-07 10:00:30";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 10:00:33";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 13:30:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 13:30:33', '7', 'addsellBill', '197.192.234.232', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 11:42:44";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 15:12:44", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 15:12:44', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 11:42:44";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 11:42:47";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 15:12:48", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 15:12:48', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 11:46:52";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 15:16:52", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 15:16:52', '8', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 11:46:53";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 11:46:59";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 15:16:59", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 15:16:59', '8', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 11:47:07";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 15:17:08", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 15:17:08', '8', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 8;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:18:47";
UPDATE user SET loginip = "197.192.234.232", lastactivetime = "2023-02-07 15:48:48", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 15:48:48', '7', '', '197.192.234.232', '', 'DESKTOP');
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 < "2023-02-07 12:18:48";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:22:03";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 15:52:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 15:52:03', '7', '', '197.192.205.142', '', 'DESKTOP');
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 < "2023-02-07 12:22:03";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:22:57";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 15:52:57", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 15:52:57', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:23:30";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 15:53:31", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 15:53:31', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:50:08";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 16:20:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 16:20:08', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 12:50:08";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 12:50:41";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 16:20:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 16:20:41', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:13:53";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:43:53", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 17:43:53', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 14:13:53";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:13:57";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:43:57", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:43:58', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:15:31";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:45:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:45:31', '5', 'addAndRetuen', '41.233.139.178', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e271be291af
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(260,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 17:43:58', '063e271be291af', '260', '970.00', '1800', '0', '1', '830', '830', '0', '830', '3', '2023-02-07 17:45:31', '', '5', '0', 'ام هنا المحل القديم', '3', '1', '3', '0', 'ام هنا المحل القديم', '2' ,'0','','','','','-1','0','0','0','0','0','830','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '1800', userid = '5' WHERE clientid = '260';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('260','970.00','830','0','اضافة فاتورة مبيعات','10148', '1800', '2023-02-07 17:45:31', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '830', '0', null, '0', null, null,'', '0','1','1','830','1');
UPDATE client SET  inUse = 0 where clientid = 260;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('290','01157', '10148', '1', '1157', '1', '330', '330', '0', '', '1', '2023-02-07 17:45:31', '1157', '0.00', '0', '3','0','','','0','0','0','0','0','0','1','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 327.50, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 327.50
                where sellbilldetailid = 29738;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1157, '2023-02-07', 330, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (3, '2023-02-07', 330, 290, 365
                    , 327.5, 365, 327.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+290
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+365, sellCostMeanBuyPrice = sellCostMeanBuyPrice+327.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+365, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+327.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '3', userid = '5', storedetaildate = '2023-02-07 17:45:31' WHERE storedetailid = '4229';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1157', '3', '1', '1', '10148', 'اضافة فاتورة مبيعات', 'sellbillController.php', '4.00', '3', '5', '2023-02-07 17:45:31','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10817;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('475','01196', '10148', '1', '1196', '1', '500', '500', '0', '', '1', '2023-02-07 17:45:31', '1196', '0.00', '0', '3','0','','','0','0','0','0','0','0','1','0','','10817-1,');
UPDATE sellbilldetail SET  lastbuyprice = 475.00 , meanbuyprice = 475.00, lastbuyprice_withDiscount = 475.00, meanbuyprice_withDiscount = 475.00
                where sellbilldetailid = 29739;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1196, '2023-02-07', 500, 475, 475
                    , 475, 475, 475, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (3, '2023-02-07', 500, 475, 475
                    , 475, 475, 475, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+500, sellCostBuyPrice =sellCostBuyPrice+475
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+475, sellCostMeanBuyPrice = sellCostMeanBuyPrice+475
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+475, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+475
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '1', userid = '5', storedetaildate = '2023-02-07 17:45:31' WHERE storedetailid = '4424';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1196', '3', '1', '1', '10148', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2.00', '1', '5', '2023-02-07 17:45:31','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 830, 765, 840
                    , 802.5, 840, 802.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+830, sellCostBuyPrice =sellCostBuyPrice+765
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+802.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+802.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (260, '2023-02-07', 830, 765, 840
                    , 802.5, 840, 802.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+830, sellCostBuyPrice =sellCostBuyPrice+765
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+802.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+802.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 830, 765, 840
                    , 802.5, 840, 802.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+830, netSellCostBuyPrice = netSellCostBuyPrice+765
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+802.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+840
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+802.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e271be291af and sellbillId = 10148 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:15:32";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:45:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:45:32', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:15:35";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:45:35", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:45:35', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:16:25";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:46:25", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:46:25', '5', 'addAndRetuen', '41.233.139.178', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e2721f55920
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(260,@clientdebt,@clientname);
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) VALUES ('2023-02-07 17:45:35', '063e2721f55920', '260', '1800.00', '940', '5', '1', '865', '860', '0', '-860', '3', '2023-02-07 17:46:26', '', '5', '0', 'ام هنا المحل القديم','3', '1', '5', '0', 'ام هنا المحل القديم', '2', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '940', userid = '5' WHERE clientid = '260';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('260','1800.00','860','1','اضافة فاتورة مردوات مبيعات','3644', '940', '2023-02-07 17:46:26', '5', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '860', '0', null, '0', null, null,'', '0','1','1','860','1');
UPDATE client SET  inUse = 0 where clientid = 260;
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) VALUES ('420.00', '01216', '3644', '1', '1216', '1', '420.00', '420', '0', '', '1', '0', '1216', '0.00', '0','3','0','','','0','0','0','0','0','1');
UPDATE returnsellbilldetail SET  lastbuyprice = 365.00 , meanbuyprice = 392.50, lastbuyprice_withDiscount = 365.00, meanbuyprice_withDiscount = 392.50
                where returnsellbilldetailid = 7740;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1216, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 422.427745665, 420, 365, 392.5
                    , 365, 392.5, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+422.427745665, returnSellCostBuyPrice = returnSellCostBuyPrice+420, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+365
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+392.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+365
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+392.5
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (3, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 422.427745665, 420, 365, 392.5
                    , 365, 392.5, 0)
                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
                        , returnSellVal = returnSellVal+422.427745665, returnSellCostBuyPrice = returnSellCostBuyPrice+420, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+365
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+392.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+365
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+392.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '2', userid = '5', storedetaildate = '2023-02-07 17:46:26' WHERE storedetailid = '4471';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1216', '3', '1', '0', '3644', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1.00', '2', '5', '2023-02-07 17:46:26','0','0');
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) VALUES ('445.00', '01201', '3644', '1', '1201', '1', '445.00', '445', '0', '', '1', '0', '1201', '0.00', '0','3','0','','','0','0','0','0','0','1');
UPDATE returnsellbilldetail SET  lastbuyprice = 445.00 , meanbuyprice = 445.00, lastbuyprice_withDiscount = 445.00, meanbuyprice_withDiscount = 445.00
                where returnsellbilldetailid = 7741;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1201, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 447.572254335, 445, 445, 445
                    , 445, 445, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+447.572254335, returnSellCostBuyPrice = returnSellCostBuyPrice+445, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+445
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+445, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+445
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+445
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (3, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 447.572254335, 445, 445, 445
                    , 445, 445, 0)
                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
                        , returnSellVal = returnSellVal+447.572254335, returnSellCostBuyPrice = returnSellCostBuyPrice+445, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+445
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+445, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+445
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+445
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '2', userid = '5', storedetaildate = '2023-02-07 17:46:26' WHERE storedetailid = '4429';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1201', '3', '1', '0', '3644', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '1.00', '2', '5', '2023-02-07 17:46:26','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 860, 865, 810, 837.5
                    , 810, 837.5, 0)
                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
                        , returnSellVal = returnSellVal+860, returnSellCostBuyPrice = returnSellCostBuyPrice+865, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+810
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+837.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+810
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+837.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (260, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 860, 865, 810, 837.5
                    , 810, 837.5, 0)
                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
                        , returnSellVal = returnSellVal+860, returnSellCostBuyPrice = returnSellCostBuyPrice+865, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+810
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+837.5, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+810
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+837.5
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -860, -865, -810
                    , -837.5, -810, -837.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-860, netSellCostBuyPrice = netSellCostBuyPrice+-865
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-810
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-837.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-810
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-837.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e2721f55920 and sellbillId = 3644 and returnsellbillId = 3644
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:16:26";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:46:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:46:26', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:16:29";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:46:29", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 17:46:29', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:16:31";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 17:46:31", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 17:46:31', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:28:15";
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:28:26";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 17:58:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 17:58:26', '1', '', '156.210.57.114', '', 'DESKTOP');
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 < "2023-02-07 14:28:26";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:28:30";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 17:58:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 17:58:30', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:31:02";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:01:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:01:02', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:31:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:01:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:01:19', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:11";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:02:11', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1195;
UPDATE productunit SET unitid = '1', productid = '1195', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0119501',proUnitSellAllPrice='445',proUnitSellHalfPrice='455',proUnitSellUnitPrice ='485',proUnitBuyPrice='450' WHERE productunitid = '1195';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1195, 1,'2023-02-07 18:02:11',1)
                ON DUPLICATE KEY UPDATE productid = 1195, edited = 1, sysdate = '2023-02-07 18:02:11', userid = 1;
UPDATE product SET productName = 'كارما1040', productDescription = '', productCatId = '1', productBuyPrice = '425', productSellAllPrice = '425', productSellUnitPrice = '470', productSellHalfPrice = '450', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01195',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '450.00',lastbuyprice_withDiscount = '450',meanbuyprice = '437.5',meanbuyprice_withDiscount = '437.5' , productbuypricereal = '425' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.88' , buypart_precentage = '10.59',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1195';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:14";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:02:14', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:16";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:02:16', '1', 'addsellBill', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:34";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:02:34', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:45";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:02:45', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:32:48";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:02:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:02:48', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:33:05";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:03:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:03:05', '1', 'addsellBill', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:33:26";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:03:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:03:26', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:33:35";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:03:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:03:35', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:33:38";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:03:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:03:38', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:02";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:02', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1196;
UPDATE productunit SET unitid = '1', productid = '1196', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0119601',proUnitSellAllPrice='475',proUnitSellHalfPrice='495',proUnitSellUnitPrice ='500',proUnitBuyPrice='475' WHERE productunitid = '1196';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1196, 1,'2023-02-07 18:04:02',1)
                ON DUPLICATE KEY UPDATE productid = 1196, edited = 1, sysdate = '2023-02-07 18:04:02', userid = 1;
UPDATE product SET productName = 'كارما1053', productDescription = '', productCatId = '1', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '495', productSellHalfPrice = '475', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01196',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475.00',lastbuyprice_withDiscount = '475',meanbuyprice = '462.5',meanbuyprice_withDiscount = '462.5' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.56' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1196';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:04";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:04', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:14";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:14', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:19";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:20', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:51";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:51', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1197;
UPDATE productunit SET unitid = '1', productid = '1197', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0119701',proUnitSellAllPrice='415',proUnitSellHalfPrice='435',proUnitSellUnitPrice ='465',proUnitBuyPrice='415' WHERE productunitid = '1197';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1197, 1,'2023-02-07 18:04:52',1)
                ON DUPLICATE KEY UPDATE productid = 1197, edited = 1, sysdate = '2023-02-07 18:04:52', userid = 1;
UPDATE product SET productName = 'كارما1023', productDescription = '', productCatId = '1', productBuyPrice = '390', productSellAllPrice = '390', productSellUnitPrice = '440', productSellHalfPrice = '415', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01197',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '415.00',lastbuyprice_withDiscount = '415',meanbuyprice = '402.5',meanbuyprice_withDiscount = '402.5' , productbuypricereal = '390' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.41' , buypart_precentage = '12.82',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1197';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:34:53";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:04:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:04:54', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:35:03";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:05:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:05:03', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:35:06";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:05:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:05:06', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:35:54";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:05:54", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:05:54', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1216;
UPDATE productunit SET unitid = '1', productid = '1216', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121601',proUnitSellAllPrice='365',proUnitSellHalfPrice='385',proUnitSellUnitPrice ='410',proUnitBuyPrice='365' WHERE productunitid = '1216';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1216, 1,'2023-02-07 18:05:54',1)
                ON DUPLICATE KEY UPDATE productid = 1216, edited = 1, sysdate = '2023-02-07 18:05:54', userid = 1;
UPDATE product SET productName = 'كارما 1023', productDescription = '', productCatId = '1', productBuyPrice = '395', productSellAllPrice = '395', productSellUnitPrice = '440', productSellHalfPrice = '420', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01216',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '365.00',lastbuyprice_withDiscount = '365',meanbuyprice = '393.75',meanbuyprice_withDiscount = '393.75' , productbuypricereal = '395' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '6.33' , buypart_precentage = '11.39',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1216';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:35:56";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:05:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:05:56', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:05";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:05', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:12";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:12', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:44";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:44', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1198;
UPDATE productunit SET unitid = '1', productid = '1198', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0119801',proUnitSellAllPrice='495',proUnitSellHalfPrice='515',proUnitSellUnitPrice ='535',proUnitBuyPrice='495' WHERE productunitid = '1198';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1198, 1,'2023-02-07 18:06:44',1)
                ON DUPLICATE KEY UPDATE productid = 1198, edited = 1, sysdate = '2023-02-07 18:06:44', userid = 1;
UPDATE product SET productName = 'كارما1090', productDescription = '', productCatId = '1', productBuyPrice = '475', productSellAllPrice = '475', productSellUnitPrice = '520', productSellHalfPrice = '500', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01198',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '495.00',lastbuyprice_withDiscount = '495',meanbuyprice = '485',meanbuyprice_withDiscount = '485' , productbuypricereal = '475' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '9.47',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1198';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:47";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:47', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:56";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:56', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:36:59";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:06:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:06:59', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:37:28";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:07:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:07:28', '1', 'addsellBill', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:38:25";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:08:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:08:25', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:38:34";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:08:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:08:34', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:38:37";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:08:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:08:37', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:39:04";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:09:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:09:04', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1215;
UPDATE productunit SET unitid = '1', productid = '1215', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121501',proUnitSellAllPrice='490',proUnitSellHalfPrice='510',proUnitSellUnitPrice ='530',proUnitBuyPrice='490' WHERE productunitid = '1215';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1215, 1,'2023-02-07 18:09:04',1)
                ON DUPLICATE KEY UPDATE productid = 1215, edited = 1, sysdate = '2023-02-07 18:09:04', userid = 1;
UPDATE product SET productName = 'كارما 1090', productDescription = '', productCatId = '1', productBuyPrice = '475', productSellAllPrice = '475', productSellUnitPrice = '510', productSellHalfPrice = '500', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01215',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '490.00',lastbuyprice_withDiscount = '490',meanbuyprice = '482.5',meanbuyprice_withDiscount = '482.5' , productbuypricereal = '475' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.26' , buypart_precentage = '7.37',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1215';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:39:06";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:09:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:09:06', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:39:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:09:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:09:18', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:39:22";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:09:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:09:22', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:40:27";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:10:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:10:27', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1199;
UPDATE productunit SET unitid = '1', productid = '1199', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0119901',proUnitSellAllPrice='360',proUnitSellHalfPrice='380',proUnitSellUnitPrice ='410',proUnitBuyPrice='360' WHERE productunitid = '1199';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1199, 1,'2023-02-07 18:10:27',1)
                ON DUPLICATE KEY UPDATE productid = 1199, edited = 1, sysdate = '2023-02-07 18:10:27', userid = 1;
UPDATE product SET productName = 'كارما1032', productDescription = '', productCatId = '1', productBuyPrice = '335', productSellAllPrice = '335', productSellUnitPrice = '375', productSellHalfPrice = '355', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01199',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '360.00',lastbuyprice_withDiscount = '360',meanbuyprice = '347.5',meanbuyprice_withDiscount = '347.5' , productbuypricereal = '335' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.97' , buypart_precentage = '11.94',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1199';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:40:29";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:10:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:10:29', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:40:39";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:10:39', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:40:39";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:10:39', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:40:44";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:10:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:10:44', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:05";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:05', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1200;
UPDATE productunit SET unitid = '1', productid = '1200', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120001',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='495',proUnitBuyPrice='445' WHERE productunitid = '1200';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1200, 1,'2023-02-07 18:11:05',1)
                ON DUPLICATE KEY UPDATE productid = 1200, edited = 1, sysdate = '2023-02-07 18:11:05', userid = 1;
UPDATE product SET productName = 'كارما1056', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01200',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.5',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1200';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:07";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:07', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:15";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:15', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:24";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:24', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE product SET productName = 'كارما 1056', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '445.00', productSellUnitPrice = '485.00', productSellHalfPrice = '465.00', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01214',type ='0', expireDate = '0' , dailyentryId = '6010',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.5',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '445.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '4.49' , buypart_precentage = '8.99',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1214';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1214, 1,'2023-02-07 18:11:24',1)
                ON DUPLICATE KEY UPDATE productid = 1214, edited = 1, sysdate = '2023-02-07 18:11:24', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:45";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:45', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1214;
UPDATE productunit SET unitid = '1', productid = '1214', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121401',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='485',proUnitBuyPrice='445' WHERE productunitid = '1214';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1214, 1,'2023-02-07 18:11:45',1)
                ON DUPLICATE KEY UPDATE productid = 1214, edited = 1, sysdate = '2023-02-07 18:11:45', userid = 1;
UPDATE product SET productName = 'كارما 1056', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01214',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.50',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1214';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:47";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:47', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:41:56";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:11:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:11:56', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:00";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:00', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:18', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1201;
UPDATE productunit SET unitid = '1', productid = '1201', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120101',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='495',proUnitBuyPrice='445' WHERE productunitid = '1201';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1201, 1,'2023-02-07 18:12:18',1)
                ON DUPLICATE KEY UPDATE productid = 1201, edited = 1, sysdate = '2023-02-07 18:12:18', userid = 1;
UPDATE product SET productName = 'كارما1027', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01201',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.5',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1201';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:20";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:20', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:28";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:28', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:31";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:31', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:42";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:42', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1201;
UPDATE productunit SET unitid = '1', productid = '1201', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120101',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='495',proUnitBuyPrice='445' WHERE productunitid = '1201';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1201, 1,'2023-02-07 18:12:42',1)
                ON DUPLICATE KEY UPDATE productid = 1201, edited = 1, sysdate = '2023-02-07 18:12:42', userid = 1;
UPDATE product SET productName = 'كارما1027', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01201',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.50',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1201';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:45";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:45', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:42:51";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:12:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:12:51', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:05";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:13:05", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 18:13:05', '7', '', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:07";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:07', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:10";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:10', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:30";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:30', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1202;
UPDATE productunit SET unitid = '1', productid = '1202', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120201',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='495',proUnitBuyPrice='445' WHERE productunitid = '1202';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1202, 1,'2023-02-07 18:13:30',1)
                ON DUPLICATE KEY UPDATE productid = 1202, edited = 1, sysdate = '2023-02-07 18:13:30', userid = 1;
UPDATE product SET productName = 'كارما1021', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01202',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.5',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1202';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:33";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:33', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:42";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:42', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:45";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:45', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:43:59";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:13:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:13:59', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1212;
UPDATE productunit SET unitid = '1', productid = '1212', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121201',proUnitSellAllPrice='445',proUnitSellHalfPrice='465',proUnitSellUnitPrice ='485',proUnitBuyPrice='445' WHERE productunitid = '1212';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1212, 1,'2023-02-07 18:13:59',1)
                ON DUPLICATE KEY UPDATE productid = 1212, edited = 1, sysdate = '2023-02-07 18:13:59', userid = 1;
UPDATE product SET productName = 'كارما 1021', productDescription = '', productCatId = '1', productBuyPrice = '420', productSellAllPrice = '420', productSellUnitPrice = '460', productSellHalfPrice = '440', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01212',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '445.00',lastbuyprice_withDiscount = '445',meanbuyprice = '432.5',meanbuyprice_withDiscount = '432.5' , productbuypricereal = '420' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.76' , buypart_precentage = '9.52',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1212';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:01";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:01', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:10";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:10', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:14";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:14', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:20";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:14:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:14:20', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:25";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:14:25", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:14:25', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:33";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:33', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1203;
UPDATE productunit SET unitid = '1', productid = '1203', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120301',proUnitSellAllPrice='465',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='495',proUnitBuyPrice='465' WHERE productunitid = '1203';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1203, 1,'2023-02-07 18:14:33',1)
                ON DUPLICATE KEY UPDATE productid = 1203, edited = 1, sysdate = '2023-02-07 18:14:33', userid = 1;
UPDATE product SET productName = 'كارما1020', productDescription = '', productCatId = '1', productBuyPrice = '440', productSellAllPrice = '440', productSellUnitPrice = '480', productSellHalfPrice = '460', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01203',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '465.00',lastbuyprice_withDiscount = '465',meanbuyprice = '452.5',meanbuyprice_withDiscount = '452.5' , productbuypricereal = '440' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.55' , buypart_precentage = '9.09',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1203';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:35";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:35', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:47";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:48', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:44:51";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:14:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:14:51', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:08";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:08', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1204;
UPDATE productunit SET unitid = '1', productid = '1204', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120401',proUnitSellAllPrice='475',proUnitSellHalfPrice='495',proUnitSellUnitPrice ='515',proUnitBuyPrice='475' WHERE productunitid = '1204';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1204, 1,'2023-02-07 18:15:08',1)
                ON DUPLICATE KEY UPDATE productid = 1204, edited = 1, sysdate = '2023-02-07 18:15:08', userid = 1;
UPDATE product SET productName = 'كارما1087', productDescription = '', productCatId = '1', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '490', productSellHalfPrice = '470', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01204',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475.00',lastbuyprice_withDiscount = '475',meanbuyprice = '462.5',meanbuyprice_withDiscount = '462.5' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.44' , buypart_precentage = '8.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1204';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:10";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:10', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:19";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:19', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:21";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:21', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:39";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:39', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1205;
UPDATE productunit SET unitid = '1', productid = '1205', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120501',proUnitSellAllPrice='455',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='495',proUnitBuyPrice='455' WHERE productunitid = '1205';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1205, 1,'2023-02-07 18:15:40',1)
                ON DUPLICATE KEY UPDATE productid = 1205, edited = 1, sysdate = '2023-02-07 18:15:40', userid = 1;
UPDATE product SET productName = 'كارما1018', productDescription = '', productCatId = '1', productBuyPrice = '430', productSellAllPrice = '430', productSellUnitPrice = '470', productSellHalfPrice = '450', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01205',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455.00',lastbuyprice_withDiscount = '455',meanbuyprice = '442.5',meanbuyprice_withDiscount = '442.5' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '9.3',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1205';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:41";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:41', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:49";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:49', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:45:53";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:15:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:15:53', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:07";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:08', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1210;
UPDATE productunit SET unitid = '1', productid = '1210', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121001',proUnitSellAllPrice='455',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='500',proUnitBuyPrice='455' WHERE productunitid = '1210';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1210, 1,'2023-02-07 18:16:08',1)
                ON DUPLICATE KEY UPDATE productid = 1210, edited = 1, sysdate = '2023-02-07 18:16:08', userid = 1;
UPDATE product SET productName = 'كارما 1018', productDescription = '', productCatId = '1', productBuyPrice = '430', productSellAllPrice = '430', productSellUnitPrice = '470', productSellHalfPrice = '450', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01210',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455.00',lastbuyprice_withDiscount = '455',meanbuyprice = '442.5',meanbuyprice_withDiscount = '442.5' , productbuypricereal = '430' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.65' , buypart_precentage = '9.3',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1210';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:09";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:09', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:18', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:21";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:21', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:48";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:48', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1206;
UPDATE productunit SET unitid = '1', productid = '1206', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120601',proUnitSellAllPrice='465',proUnitSellHalfPrice='485',proUnitSellUnitPrice ='515',proUnitBuyPrice='465' WHERE productunitid = '1206';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1206, 1,'2023-02-07 18:16:48',1)
                ON DUPLICATE KEY UPDATE productid = 1206, edited = 1, sysdate = '2023-02-07 18:16:48', userid = 1;
UPDATE product SET productName = 'كارما1096', productDescription = '', productCatId = '1', productBuyPrice = '445', productSellAllPrice = '445', productSellUnitPrice = '485', productSellHalfPrice = '465', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01206',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '465.00',lastbuyprice_withDiscount = '465',meanbuyprice = '455',meanbuyprice_withDiscount = '455' , productbuypricereal = '445' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.49' , buypart_precentage = '8.99',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1206';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:51";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:51', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:46:58";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:16:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:16:58', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:00";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:00', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:20";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:20', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1207;
UPDATE productunit SET unitid = '1', productid = '1207', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120701',proUnitSellAllPrice='425',proUnitSellHalfPrice='450',proUnitSellUnitPrice ='475',proUnitBuyPrice='425' WHERE productunitid = '1207';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1207, 1,'2023-02-07 18:17:20',1)
                ON DUPLICATE KEY UPDATE productid = 1207, edited = 1, sysdate = '2023-02-07 18:17:20', userid = 1;
UPDATE product SET productName = 'كارما1085', productDescription = '', productCatId = '1', productBuyPrice = '400', productSellAllPrice = '400', productSellUnitPrice = '440', productSellHalfPrice = '420', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01207',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425.00',lastbuyprice_withDiscount = '425',meanbuyprice = '412.5',meanbuyprice_withDiscount = '412.5' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1207';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:22";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:22', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:29";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:29', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:33";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:33', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:45";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:45', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1207;
UPDATE productunit SET unitid = '1', productid = '1207', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120701',proUnitSellAllPrice='425',proUnitSellHalfPrice='450',proUnitSellUnitPrice ='475',proUnitBuyPrice='425' WHERE productunitid = '1207';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1207, 1,'2023-02-07 18:17:45',1)
                ON DUPLICATE KEY UPDATE productid = 1207, edited = 1, sysdate = '2023-02-07 18:17:45', userid = 1;
UPDATE product SET productName = 'كارما1085', productDescription = '', productCatId = '1', productBuyPrice = '400', productSellAllPrice = '400', productSellUnitPrice = '440', productSellHalfPrice = '420', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01207',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425.00',lastbuyprice_withDiscount = '425',meanbuyprice = '412.50',meanbuyprice_withDiscount = '412.5' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1207';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:47";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:47', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:47:59";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:17:59", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:17:59', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:03";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:03', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:16";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:16', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1213;
UPDATE productunit SET unitid = '1', productid = '1213', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121301',proUnitSellAllPrice='425',proUnitSellHalfPrice='445',proUnitSellUnitPrice ='465',proUnitBuyPrice='425' WHERE productunitid = '1213';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1213, 1,'2023-02-07 18:18:16',1)
                ON DUPLICATE KEY UPDATE productid = 1213, edited = 1, sysdate = '2023-02-07 18:18:16', userid = 1;
UPDATE product SET productName = 'كارما 1085', productDescription = '', productCatId = '1', productBuyPrice = '400', productSellAllPrice = '400', productSellUnitPrice = '440', productSellHalfPrice = '420', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01213',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '425.00',lastbuyprice_withDiscount = '425',meanbuyprice = '412.5',meanbuyprice_withDiscount = '412.5' , productbuypricereal = '400' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5' , buypart_precentage = '10',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1213';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:18', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:28";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:28', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE product SET productName = 'كارما1062', productDescription = '', productCatId = '1', productBuyPrice = '490', productSellAllPrice = '515.00', productSellUnitPrice = '555.00', productSellHalfPrice = '535.00', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01208',type ='0', expireDate = '0' , dailyentryId = '5917',isService = '0',isOptic = '0',lastbuyprice = '515.00',lastbuyprice_withDiscount = '515',meanbuyprice = '502.5',meanbuyprice_withDiscount = '502.5' , productbuypricereal = '515.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '3.88' , buypart_precentage = '7.77',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1208';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1208, 1,'2023-02-07 18:18:36',1)
                ON DUPLICATE KEY UPDATE productid = 1208, edited = 1, sysdate = '2023-02-07 18:18:36', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:36";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:36', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:55";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:55', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1208;
UPDATE productunit SET unitid = '1', productid = '1208', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120801',proUnitSellAllPrice='515',proUnitSellHalfPrice='535',proUnitSellUnitPrice ='555',proUnitBuyPrice='515' WHERE productunitid = '1208';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1208, 1,'2023-02-07 18:18:55',1)
                ON DUPLICATE KEY UPDATE productid = 1208, edited = 1, sysdate = '2023-02-07 18:18:55', userid = 1;
UPDATE product SET productName = 'كارما1062', productDescription = '', productCatId = '1', productBuyPrice = '490', productSellAllPrice = '490', productSellUnitPrice = '530', productSellHalfPrice = '515', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01208',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '515.00',lastbuyprice_withDiscount = '515',meanbuyprice = '502.50',meanbuyprice_withDiscount = '502.5' , productbuypricereal = '490' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.1' , buypart_precentage = '8.16',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1208';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:48:57";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:18:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:18:57', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:18";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:18', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:21";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:21', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:40";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:40', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1209;
UPDATE productunit SET unitid = '1', productid = '1209', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120901',proUnitSellAllPrice='475',proUnitSellHalfPrice='495',proUnitSellUnitPrice ='515',proUnitBuyPrice='475' WHERE productunitid = '1209';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1209, 1,'2023-02-07 18:19:40',1)
                ON DUPLICATE KEY UPDATE productid = 1209, edited = 1, sysdate = '2023-02-07 18:19:40', userid = 1;
UPDATE product SET productName = 'كارما1000', productDescription = '', productCatId = '1', productBuyPrice = '450', productSellAllPrice = '450', productSellUnitPrice = '490', productSellHalfPrice = '470', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01209',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '475.00',lastbuyprice_withDiscount = '475',meanbuyprice = '462.5',meanbuyprice_withDiscount = '462.5' , productbuypricereal = '450' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.44' , buypart_precentage = '8.89',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1209';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:43";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:43', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:53";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:53', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:49:56";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:19:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:19:56', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:13";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:13', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1205;
UPDATE productunit SET unitid = '1', productid = '1205', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0120501',proUnitSellAllPrice='455',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='495',proUnitBuyPrice='455' WHERE productunitid = '1205';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1205, 1,'2023-02-07 18:20:13',1)
                ON DUPLICATE KEY UPDATE productid = 1205, edited = 1, sysdate = '2023-02-07 18:20:13', userid = 1;
UPDATE product SET productName = 'كارما1018', productDescription = '', productCatId = '1', productBuyPrice = '410', productSellAllPrice = '410', productSellUnitPrice = '450', productSellHalfPrice = '430', productDate = '2023-01-13', conditions = '0', userId = '1', limitamount = '0', parcode = '01205',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455.00',lastbuyprice_withDiscount = '455',meanbuyprice = '426.25',meanbuyprice_withDiscount = '426.25' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '9.76',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1205';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:15";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:15', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:23";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:23', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:26";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:26', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:42";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:42', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1210;
UPDATE productunit SET unitid = '1', productid = '1210', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121001',proUnitSellAllPrice='455',proUnitSellHalfPrice='475',proUnitSellUnitPrice ='500',proUnitBuyPrice='455' WHERE productunitid = '1210';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1210, 1,'2023-02-07 18:20:42',1)
                ON DUPLICATE KEY UPDATE productid = 1210, edited = 1, sysdate = '2023-02-07 18:20:42', userid = 1;
UPDATE product SET productName = 'كارما 1018', productDescription = '', productCatId = '1', productBuyPrice = '410', productSellAllPrice = '410', productSellUnitPrice = '450', productSellHalfPrice = '430', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01210',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '455.00',lastbuyprice_withDiscount = '455',meanbuyprice = '426.25',meanbuyprice_withDiscount = '426.25' , productbuypricereal = '410' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '4.88' , buypart_precentage = '9.76',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1210';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:44";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:44', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:53";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:53', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:50:56";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:20:56", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:20:56', '1', 'edit', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:51:11";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:21:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:21:12', '1', 'update', '156.210.57.114', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 1211;
UPDATE productunit SET unitid = '1', productid = '1211', productnumber = '1.00', productunitdate = '2023-02-07', userid = '1', conditions = '0',proUnitParcode='0121101',proUnitSellAllPrice='385',proUnitSellHalfPrice='405',proUnitSellUnitPrice ='425',proUnitBuyPrice='385' WHERE productunitid = '1211';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (1211, 1,'2023-02-07 18:21:12',1)
                ON DUPLICATE KEY UPDATE productid = 1211, edited = 1, sysdate = '2023-02-07 18:21:12', userid = 1;
UPDATE product SET productName = 'كارما 1030', productDescription = '', productCatId = '1', productBuyPrice = '360', productSellAllPrice = '360', productSellUnitPrice = '400', productSellHalfPrice = '380', productDate = '2023-01-23', conditions = '0', userId = '1', limitamount = '0', parcode = '01211',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '385.00',lastbuyprice_withDiscount = '385',meanbuyprice = '372.5',meanbuyprice_withDiscount = '372.5' , productbuypricereal = '360' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5.56' , buypart_precentage = '11.11',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '1211';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:51:14";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:21:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2023-02-07 18:21:14', '1', 'show', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:51:16";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:21:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:21:16', '1', 'addsellBill', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:55:08";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:25:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('transfermoneyController.php', '2023-02-07 18:25:08', '1', '', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:55:38";
UPDATE user SET loginip = "156.210.57.114", lastactivetime = "2023-02-07 18:25:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:25:39', '1', 'addsellBill', '156.210.57.114', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:57:11";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:27:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:27:11', '7', 'addAndRetuen', '197.192.205.142', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e278e170844
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 18:14:25', '063e278e170844', '1', '0.00', '0', '0', '1', '230', '230', '230', '0', '5', '2023-02-07 18:27:11', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','230','0','','0','0','230','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10149', '0', '2023-02-07 18:27:11', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '230', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('220','01140', '10149', '1', '1140', '1', '230', '230', '0', '', '0', '2023-02-07 18:27:11', '1140', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 220.00 , meanbuyprice = 220.00, lastbuyprice_withDiscount = 220.00, meanbuyprice_withDiscount = 220.00
                where sellbilldetailid = 29740;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1140, '2023-02-07', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '2', userid = '7', storedetaildate = '2023-02-07 18:27:11' WHERE storedetailid = '4167';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1140', '5', '1', '1', '10149', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3.00', '2', '7', '2023-02-07 18:27:11','0','0');
UPDATE save SET  savecurrentvalue = '330',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('100.00','230', '0', '5', 'اضافة فاتورة مبيعات', '10149', '330', '2023-02-07 18:27:11', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 230, 220, 220
                    , 220, 220, 220, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+230, sellCostBuyPrice =sellCostBuyPrice+220
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+220, sellCostMeanBuyPrice = sellCostMeanBuyPrice+220
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+220, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+220
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 230, 220, 220
                    , 220, 220, 220, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+230, netSellCostBuyPrice = netSellCostBuyPrice+220
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+220
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+220
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+220
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+220
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e278e170844 and sellbillId = 10149 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:57:11";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:27:11", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:27:12', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:58:20";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:28:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:28:20', '7', 'addAndRetuen', '197.192.205.142', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e27be01bc82
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 18:27:12', '063e27be01bc82', '1', '0.00', '0', '0', '1', '330', '330', '330', '0', '5', '2023-02-07 18:28:20', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','330','0','','0','0','330','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10150', '0', '2023-02-07 18:28:20', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '330', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10503;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('330','01188', '10150', '1', '1188', '1', '330.00', '330', '0', '', '0', '2023-02-07 18:28:20', '1188', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','10503-1,');
UPDATE sellbilldetail SET  lastbuyprice = 330.00 , meanbuyprice = 330.00, lastbuyprice_withDiscount = 330.00, meanbuyprice_withDiscount = 330.00
                where sellbilldetailid = 29741;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1188, '2023-02-07', 330, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 330, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '5', userid = '7', storedetaildate = '2023-02-07 18:28:20' WHERE storedetailid = '4382';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1188', '5', '1', '1', '10150', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6.00', '5', '7', '2023-02-07 18:28:20','0','0');
UPDATE save SET  savecurrentvalue = '660',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('330.00','330', '0', '5', 'اضافة فاتورة مبيعات', '10150', '660', '2023-02-07 18:28:20', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 330, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 330, 330, 330
                    , 330, 330, 330, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+330, sellCostBuyPrice =sellCostBuyPrice+330
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+330, sellCostMeanBuyPrice = sellCostMeanBuyPrice+330
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+330, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+330
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 330, 330, 330
                    , 330, 330, 330, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+330, netSellCostBuyPrice = netSellCostBuyPrice+330
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+330
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+330
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+330
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+330
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e27be01bc82 and sellbillId = 10150 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 14:58:20";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:28:20", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:28:20', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:07:35";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:37:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:37:35', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:09:54";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:39:54", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:39:55', '7', 'addAndRetuen', '197.192.205.142', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e27e500590e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(60,@clientdebt,@clientname);
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 18:37:36', '063e27e500590e', '60', '1150.00', '1395', '175', '1', '1055', '880', '635', '245', '5', '2023-02-07 18:39:55', '', '7', '0', 'ام حميس خطاب', '5', '1', '3', '0', 'ام حميس خطاب', '4' ,'0','','','','','-1','0','0','0','0','0','880','0','','0','0','635','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '1395', userid = '7' WHERE clientid = '60';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('60','1150.00','245','0','اضافة فاتورة مبيعات','10151', '1395', '2023-02-07 18:39:55', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '880', '0', null, '0', null, null,'', '0','1','1','245','1');
UPDATE client SET  inUse = 0 where clientid = 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) VALUES ('280','01174', '10151', '1', '1174', '1', '280.00', '280', '0', '', '0', '2023-02-07 18:39:55', '1174', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 280.00 , meanbuyprice = 280.00, lastbuyprice_withDiscount = 280.00, meanbuyprice_withDiscount = 280.00
                where sellbilldetailid = 29742;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1174, '2023-02-07', 233.55450237, 280, 280
                    , 280, 280, 280, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+233.55450237, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 233.55450237, 280, 280
                    , 280, 280, 280, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+233.55450237, sellCostBuyPrice =sellCostBuyPrice+280
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+280, sellCostMeanBuyPrice = sellCostMeanBuyPrice+280
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+280, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+280
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '2', userid = '7', storedetaildate = '2023-02-07 18:39:55' WHERE storedetailid = '4313';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1174', '5', '1', '1', '10151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '3.00', '2', '7', '2023-02-07 18:39:55','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10221;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('270','01172', '10151', '1', '1172', '1', '280.00', '280', '0', '', '0', '2023-02-07 18:39:55', '1172', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','10221-1,');
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where sellbilldetailid = 29743;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1172, '2023-02-07', 233.55450237, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+233.55450237, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 233.55450237, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+233.55450237, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '7', storedetaildate = '2023-02-07 18:39:55' WHERE storedetailid = '4316';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1172', '5', '1', '1', '10151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '14.00', '13', '7', '2023-02-07 18:39:55','0','0');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10136;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('260','01165', '10151', '1', '1165', '1', '270', '270', '0', '', '0', '2023-02-07 18:39:55', '1165', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','10136-1,');
UPDATE sellbilldetail SET  lastbuyprice = 260.00 , meanbuyprice = 260.00, lastbuyprice_withDiscount = 260.00, meanbuyprice_withDiscount = 260.00
                where sellbilldetailid = 29744;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1165, '2023-02-07', 225.213270142, 260, 260
                    , 260, 260, 260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225.213270142, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 225.213270142, 260, 260
                    , 260, 260, 260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+225.213270142, sellCostBuyPrice =sellCostBuyPrice+260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+260
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '5', userid = '7', storedetaildate = '2023-02-07 18:39:55' WHERE storedetailid = '4287';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1165', '5', '1', '1', '10151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '6.00', '5', '7', '2023-02-07 18:39:55','0','0');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('225','01144', '10151', '1', '1144', '1', '225.00', '225', '0', '', '0', '2023-02-07 18:39:55', '1144', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 225.00 , meanbuyprice = 225.00, lastbuyprice_withDiscount = 225.00, meanbuyprice_withDiscount = 225.00
                where sellbilldetailid = 29745;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1144, '2023-02-07', 187.677725118, 225, 225
                    , 225, 225, 225, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+187.677725118, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 187.677725118, 225, 225
                    , 225, 225, 225, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+187.677725118, sellCostBuyPrice =sellCostBuyPrice+225
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+225, sellCostMeanBuyPrice = sellCostMeanBuyPrice+225
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+225, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+225
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '12', userid = '7', storedetaildate = '2023-02-07 18:39:55' WHERE storedetailid = '4187';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1144', '5', '1', '1', '10151', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '12', '7', '2023-02-07 18:39:55','0','0');
UPDATE save SET  savecurrentvalue = '1295',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('660.00','635', '0', '5', 'اضافة فاتورة مبيعات', '10151', '1295', '2023-02-07 18:39:55', '7',  'sellbillController.php','60','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 880, 1035, 1035
                    , 1035, 1035, 1035, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, sellCostBuyPrice =sellCostBuyPrice+1035
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1035, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1035
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1035, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1035
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (60, '2023-02-07', 880, 1035, 1035
                    , 1035, 1035, 1035, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+880, sellCostBuyPrice =sellCostBuyPrice+1035
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1035, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1035
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1035, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1035
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 880, 1035, 1035
                    , 1035, 1035, 1035, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+880, netSellCostBuyPrice = netSellCostBuyPrice+1035
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+1035
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+1035
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+1035
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+1035
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e27e500590e and sellbillId = 10151 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:09:55";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:39:55", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:39:55', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:10:02";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:40:02", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:40:02', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:12:25";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:42:26", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:42:26', '7', 'addAndRetuen', '197.192.205.142', '', 'DESKTOP');
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e27ee36671b
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(60,@clientdebt,@clientname);
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) VALUES ('2023-02-07 18:40:03', '063e27ee36671b', '60', '1395.00', '650', '15', '1', '760', '745', '0', '-745', '5', '2023-02-07 18:42:26', '', '7', '0', 'ام حميس خطاب','5', '1', '5', '0', 'ام حميس خطاب', '4', '0', '', '','','','-1','0','0','0','','0','0','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '650', userid = '7' WHERE clientid = '60';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('60','1395.00','745','1','اضافة فاتورة مردوات مبيعات','3645', '650', '2023-02-07 18:42:26', '7', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '745', '0', null, '0', null, null,'', '0','1','1','745','1');
UPDATE client SET  inUse = 0 where clientid = 60;
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) VALUES ('140.00', '00855', '3645', '1', '855', '1', '150.00', '150', '0', '', '0', '0', '855', '0.00', '0','5','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 140.00 , meanbuyprice = 140.00, lastbuyprice_withDiscount = 140.00, meanbuyprice_withDiscount = 140.00
                where returnsellbilldetailid = 7742;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (855, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 152.960526316, 140, 140, 140
                    , 140, 140, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+152.960526316, returnSellCostBuyPrice = returnSellCostBuyPrice+140, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+140
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+140, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+140
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+140
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (5, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 152.960526316, 140, 140, 140
                    , 140, 140, 0)
                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
                        , returnSellVal = returnSellVal+152.960526316, returnSellCostBuyPrice = returnSellCostBuyPrice+140, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+140
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+140, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+140
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+140
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '16', userid = '7', storedetaildate = '2023-02-07 18:42:26' WHERE storedetailid = '2742';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('855', '5', '1', '0', '3645', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '15.00', '16', '7', '2023-02-07 18:42:26','0','0');
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) VALUES ('205.00', '00227', '3645', '1', '227', '1', '220.00', '220', '0', '', '0', '0', '227', '0.00', '0','5','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 205.00 , meanbuyprice = 205.00, lastbuyprice_withDiscount = 205.00, meanbuyprice_withDiscount = 205.00
                where returnsellbilldetailid = 7743;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (227, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 224.342105263, 205, 205, 205
                    , 205, 205, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+224.342105263, returnSellCostBuyPrice = returnSellCostBuyPrice+205, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+205
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+205, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+205
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+205
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (5, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 224.342105263, 205, 205, 205
                    , 205, 205, 0)
                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
                        , returnSellVal = returnSellVal+224.342105263, returnSellCostBuyPrice = returnSellCostBuyPrice+205, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+205
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+205, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+205
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+205
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '7', userid = '7', storedetaildate = '2023-02-07 18:42:26' WHERE storedetailid = '3234';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('227', '5', '1', '0', '3645', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '6.00', '7', '7', '2023-02-07 18:42:26','0','0');
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) VALUES ('210.00', '01012', '3645', '1', '1012', '1', '220.00', '220', '0', '', '0', '0', '1012', '0.00', '0','5','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where returnsellbilldetailid = 7744;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1012, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 224.342105263, 210, 210, 210
                    , 210, 210, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+224.342105263, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (5, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 224.342105263, 210, 210, 210
                    , 210, 210, 0)
                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
                        , returnSellVal = returnSellVal+224.342105263, returnSellCostBuyPrice = returnSellCostBuyPrice+210, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+210
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+210, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+210
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+210
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '13', userid = '7', storedetaildate = '2023-02-07 18:42:26' WHERE storedetailid = '3473';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1012', '5', '1', '0', '3645', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '12.00', '13', '7', '2023-02-07 18:42:26','0','0');
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) VALUES ('150.00', '00124', '3645', '1', '124', '1', '170.00', '170', '0', '', '0', '0', '124', '0.00', '0','5','0','','','0','0','0','0','0','0');
UPDATE returnsellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 160.63, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 160.63
                where returnsellbilldetailid = 7745;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (124, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 173.355263158, 150, 185, 160.63
                    , 185, 160.63, 0, 0, 1)
                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
                        , returnSellVal = returnSellVal+173.355263158, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+160.63, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+160.63
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , 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)
                    VALUES (5, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 173.355263158, 150, 185, 160.63
                    , 185, 160.63, 0)
                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
                        , returnSellVal = returnSellVal+173.355263158, returnSellCostBuyPrice = returnSellCostBuyPrice+150, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+185
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+160.63, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+185
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+160.63
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '12', userid = '7', storedetaildate = '2023-02-07 18:42:26' WHERE storedetailid = '915';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('124', '5', '1', '0', '3645', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '11.00', '12', '7', '2023-02-07 18:42:26','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 745, 705, 740, 715.63
                    , 740, 715.63, 0)
                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
                        , returnSellVal = returnSellVal+745, returnSellCostBuyPrice = returnSellCostBuyPrice+705, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+740
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+715.63, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+740
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+715.63
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (60, '2023-02-07', 0, 0, 0
                    , 0, 0, 0, 0
                    , 745, 705, 740, 715.63
                    , 740, 715.63, 0)
                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
                        , returnSellVal = returnSellVal+745, returnSellCostBuyPrice = returnSellCostBuyPrice+705, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+740
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+715.63, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+740
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+715.63
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -745, -705, -740
                    , -715.63, -740, -715.63, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-745, netSellCostBuyPrice = netSellCostBuyPrice+-705
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-740
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-715.63
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-740
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-715.63
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e27ee36671b and sellbillId = 3645 and returnsellbillId = 3645
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:12:26";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:42:27", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:42:27', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:12:36";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:42:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:42:36', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:13:33";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:43:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:43:33', '7', 'addAndRetuen', '197.192.205.142', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e27f7c34372
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 18:42:36', '063e27f7c34372', '1', '0.00', '0', '0', '1', '340', '340', '340', '0', '5', '2023-02-07 18:43:33', '', '7', '0', 'نقدي', '5', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','340','0','','0','0','340','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '7' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10152', '0', '2023-02-07 18:43:33', '7', 'sellbillController.php', 'اضافة فاتورة مبيعات', '340', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10603;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('340','01193', '10152', '1', '1193', '1', '340.00', '340', '0', '', '0', '2023-02-07 18:43:33', '1193', '0.00', '0', '5','0','','','0','0','0','0','0','0','0','0','','10603-1,');
UPDATE sellbilldetail SET  lastbuyprice = 340.00 , meanbuyprice = 340.00, lastbuyprice_withDiscount = 340.00, meanbuyprice_withDiscount = 340.00
                where sellbilldetailid = 29746;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1193, '2023-02-07', 340, 340, 340
                    , 340, 340, 340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+340
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (5, '2023-02-07', 340, 340, 340
                    , 340, 340, 340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+340
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '7', storedetaildate = '2023-02-07 18:43:33' WHERE storedetailid = '4397';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1193', '5', '1', '1', '10152', 'اضافة فاتورة مبيعات', 'sellbillController.php', '1.00', '0', '7', '2023-02-07 18:43:33','0','0');
UPDATE save SET  savecurrentvalue = '1635',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1295.00','340', '0', '5', 'اضافة فاتورة مبيعات', '10152', '1635', '2023-02-07 18:43:33', '7',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 340, 340, 340
                    , 340, 340, 340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+340
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 340, 340, 340
                    , 340, 340, 340, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+340, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+340, sellCostMeanBuyPrice = sellCostMeanBuyPrice+340
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+340, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+340
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 340, 340, 340
                    , 340, 340, 340, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+340, netSellCostBuyPrice = netSellCostBuyPrice+340
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+340
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+340
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+340
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+340
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e27f7c34372 and sellbillId = 10152 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:13:33";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:43:33", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:43:33', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:13:44";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:43:44", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 18:43:44', '7', '', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:13:47";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:43:47", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 18:43:47', '7', 'showDetail', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 15:13:58";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 18:43:59", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 18:43:59', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:18:45";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 19:48:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 19:48:45', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 16:18:45";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:18:50";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 19:48:50", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:48:50', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:19:01";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 19:49:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:49:01', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:22:08";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:52:09", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 19:52:09', '8', '', '197.35.27.193', '', 'DESKTOP');
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 < "2023-02-07 16:22:09";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:22:26";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:52:26", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:52:26', '8', 'addsellBill', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:06";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:06", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:53:06', '8', 'addAndRetuen', '197.35.27.193', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e28fda92058
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 19:52:26', '063e28fda92058', '1', '0.00', '0', '0', '1', '290', '290', '290', '0', '6', '2023-02-07 19:53:06', '', '8', '0', 'نقدي', '6', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','290','0','','0','0','290','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '8' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10153', '0', '2023-02-07 19:53:06', '8', 'sellbillController.php', 'اضافة فاتورة مبيعات', '290', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10126;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('270','01163', '10153', '1', '1163', '1', '290.00', '290', '0', '', '2', '2023-02-07 19:53:06', '1163', '0.00', '0', '6','0','','','0','0','0','0','0','0','2','0','','10126-1,');
UPDATE sellbilldetail SET  lastbuyprice = 270.00 , meanbuyprice = 270.00, lastbuyprice_withDiscount = 270.00, meanbuyprice_withDiscount = 270.00
                where sellbilldetailid = 29747;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (1163, '2023-02-07', 290, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (6, '2023-02-07', 290, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '9', userid = '8', storedetaildate = '2023-02-07 19:53:06' WHERE storedetailid = '4271';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('1163', '6', '1', '1', '10153', 'اضافة فاتورة مبيعات', 'sellbillController.php', '10.00', '9', '8', '2023-02-07 19:53:06','0','0');
UPDATE save SET  savecurrentvalue = '1115',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('825.00','290', '0', '6', 'اضافة فاتورة مبيعات', '10153', '1115', '2023-02-07 19:53:06', '8',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 290, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 290, 270, 270
                    , 270, 270, 270, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+290, sellCostBuyPrice =sellCostBuyPrice+270
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+270, sellCostMeanBuyPrice = sellCostMeanBuyPrice+270
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+270, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+270
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 290, 270, 270
                    , 270, 270, 270, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+290, netSellCostBuyPrice = netSellCostBuyPrice+270
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+270
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+270
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+270
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+270
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e28fda92058 and sellbillId = 10153 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:06";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:07", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:53:07', '8', 'addsellBill', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:09";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:09", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:09', '8', '', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:24";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:24", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:24', '8', 'add', '197.35.27.193', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('2', 'جهاد', '', '500', '2023-02-07', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '615',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1115.00','500', '1', '6', 'إضافة مصروف', '2581', '615', '2023-02-07 19:53:24', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '500', '500', '2023-02-07', '8', '0', '0', '2023-02-07 19:53:24','اضافة اسم مصروف( جهاد )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6141', '145', '500', '','0');
UPDATE accountstree SET name = 'مرتبات', customName = 'مرتبات', parent = '14', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-08', itemtype2 = '0', theValue = '324980', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '145';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6141', '140', '500', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-762120', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '2', expensesname = 'جهاد', expensesdetails = '', expensesValue = '500.00', expensesdate = '2023-02-07', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '6141', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2581';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:24";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:24", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:25', '8', 'sucess', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:26";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:26", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:26', '8', 'show', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:33";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:33", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:33', '8', '', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:57";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:57", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:57', '8', 'add', '197.35.27.193', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'عماد حمدي', '', '100', '2023-02-07', '8', '0','-1','6','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '515',  userid = '8' WHERE saveid = '6';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('615.00','100', '1', '6', 'إضافة مصروف', '2582', '515', '2023-02-07 19:53:57', '8',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '100', '100', '2023-02-07', '8', '0', '0', '2023-02-07 19:53:57','اضافة اسم مصروف( عماد حمدي )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6142', '160', '100', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-1094630', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6142', '140', '100', '','0');
UPDATE accountstree SET name = 'خزينة محل كفر الدوار', customName = 'خزينة محل كفر الدوار', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-11-07', itemtype2 = '1', theValue = '-762220', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '140';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'عماد حمدي', expensesdetails = '', expensesValue = '100.00', expensesdate = '2023-02-07', userid = '8', conditions = '0',saveid = '6' , dailyentryid = '6142', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2582';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:58";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:58", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:58', '8', 'sucess', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:23:59";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:53:59", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 19:53:59', '8', 'show', '197.35.27.193', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:24:01";
UPDATE user SET loginip = "197.35.27.193", lastactivetime = "2023-02-07 19:54:01", deviceType = "DESKTOP" WHERE userid = 8;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 19:54:01', '8', '', '197.35.27.193', '', 'DESKTOP');
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:28:23";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 19:58:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 19:58:23', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 16:28:23";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 16:28:33";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 19:58:33", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 19:58:33', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:27:45";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:57:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 20:57:45', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 17:27:45";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:27:49";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:57:49", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:57:49', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:28:08";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:58:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 20:58:08', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 17:28:09";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:28:11";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:58:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:58:11', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:28:56";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:58:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:58:56', '5', 'addAndRetuen', '41.233.139.178', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e29f4358a4e
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 20:58:11', '063e29f4358a4e', '1', '0.00', '0', '5', '1', '175', '170', '170', '0', '3', '2023-02-07 20:58:56', '', '5', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','170','0','','0','0','170','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '5' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10154', '0', '2023-02-07 20:58:56', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '170', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 10508;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('185','00383', '10154', '1', '383', '1', '175', '175', '0', '', '0', '2023-02-07 20:58:56', '383', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','10508-1,');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 167.50, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 167.50
                where sellbilldetailid = 29748;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (383, '2023-02-07', 170, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (3, '2023-02-07', 170, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '4', userid = '5', storedetaildate = '2023-02-07 20:58:56' WHERE storedetailid = '1443';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('383', '3', '1', '1', '10154', 'اضافة فاتورة مبيعات', 'sellbillController.php', '5.00', '4', '5', '2023-02-07 20:58:56','0','0');
UPDATE save SET  savecurrentvalue = '2795',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2625.00','170', '0', '3', 'اضافة فاتورة مبيعات', '10154', '2795', '2023-02-07 20:58:56', '5',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 170, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 170, 150, 185
                    , 167.5, 185, 167.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+170, sellCostBuyPrice =sellCostBuyPrice+150
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+167.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+167.5
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 170, 150, 185
                    , 167.5, 185, 167.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+170, netSellCostBuyPrice = netSellCostBuyPrice+150
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+185
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+167.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+185
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+167.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e29f4358a4e and sellbillId = 10154 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:28:56";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:58:56", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:58:56', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:29:37";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:59:41", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:59:42', '5', 'addAndRetuen', '41.233.139.178', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e29f70ef61f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 20:58:56', '063e29f70ef61f', '1', '0.00', '0', '0', '1', '600', '600', '600', '0', '3', '2023-02-07 20:59:42', '', '5', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '4' ,'0','','','','','-1','0','0','0','0','0','600','0','','0','0','600','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '5' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10155', '0', '2023-02-07 20:59:42', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '600', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('150','00517', '10155', '1', '517', '4', '150', '600', '0', '', '0', '2023-02-07 20:59:42', '517', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 180.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 180.00
                where sellbilldetailid = 29749;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (517, '2023-02-07', 600, 600, 840
                    , 720, 840, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 4, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (3, '2023-02-07', 600, 600, 840
                    , 720, 840, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '3', userid = '5', storedetaildate = '2023-02-07 20:59:42' WHERE storedetailid = '1451';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('517', '3', '4', '1', '10155', 'اضافة فاتورة مبيعات', 'sellbillController.php', '7.00', '3', '5', '2023-02-07 20:59:42','0','0');
UPDATE save SET  savecurrentvalue = '3395',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('2795.00','600', '0', '3', 'اضافة فاتورة مبيعات', '10155', '3395', '2023-02-07 20:59:42', '5',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 600, 600, 840
                    , 720, 840, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 600, 600, 840
                    , 720, 840, 720, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+600, sellCostBuyPrice =sellCostBuyPrice+600
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+840, sellCostMeanBuyPrice = sellCostMeanBuyPrice+720
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+840, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+720
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 600, 600, 840
                    , 720, 840, 720, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+600, netSellCostBuyPrice = netSellCostBuyPrice+600
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+840
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+720
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+840
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+720
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e29f70ef61f and sellbillId = 10155 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:29:43";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 20:59:43", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 20:59:43', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:30:38";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:00:38", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 21:00:38', '5', 'addAndRetuen', '41.233.139.178', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 063e29f9f48b36
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,obygyVisitId,onlineOrderId,delbyuserid,delivery,totalafterdelivery,billReservation,billReservationDate,webApiId,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal,taxBillNumber,collectionType,collectionDate) VALUES ('2023-02-07 20:59:43', '063e29f9f48b36', '1', '0.00', '0', '0', '1', '300', '300', '300', '0', '3', '2023-02-07 21:00:38', '', '5', '0', 'نقدي', '3', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','300','0','','0','0','300','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '5' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','10156', '0', '2023-02-07 21:00:38', '5', 'sellbillController.php', 'اضافة فاتورة مبيعات', '300', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, sellbilldetailtotalprice, discountvalue, note, pricetype, sellbilldetaildate, productunitid, buydiscount, buydiscounttype,storeid,discounttype,lastbuyprice,meanbuyprice,lastbuyprice_withDiscount,meanbuyprice_withDiscount,otherdetailquantity,sizeid,colorid,onlineOrderId,pricetypepro,playstationPlayId,soldSerialsInDetails,buyPricesHistoryBookIdQuantity) VALUES ('170','00513', '10156', '1', '513', '2', '150.00', '300', '0', '', '0', '2023-02-07 21:00:39', '513', '0.00', '0', '3','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 190.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 190.00
                where sellbilldetailid = 29750;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (513, '2023-02-07', 300, 340, 420
                    , 380, 420, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+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)
                    VALUES (3, '2023-02-07', 300, 340, 420
                    , 380, 420, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '0', userid = '5', storedetaildate = '2023-02-07 21:00:39' WHERE storedetailid = '1447';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('513', '3', '2', '1', '10156', 'اضافة فاتورة مبيعات', 'sellbillController.php', '2.00', '0', '5', '2023-02-07 21:00:39','0','0');
UPDATE save SET  savecurrentvalue = '3695',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3395.00','300', '0', '3', 'اضافة فاتورة مبيعات', '10156', '3695', '2023-02-07 21:00:39', '5',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2023-02-07', 300, 340, 420
                    , 380, 420, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2023-02-07', 300, 340, 420
                    , 380, 420, 380, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+300, sellCostBuyPrice =sellCostBuyPrice+340
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+380
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+380
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, 300, 340, 420
                    , 380, 420, 380, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+300, netSellCostBuyPrice = netSellCostBuyPrice+340
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+420
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+380
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+420
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+380
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 063e29f9f48b36 and sellbillId = 10156 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:30:39";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:00:39", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 21:00:39', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:31:06";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:01:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 21:01:06', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:31:18";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:01:18", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 21:01:18', '5', 'showDetail', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:33:05";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:03:05", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 21:03:05', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 17:33:06";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 17:33:08";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 21:03:08", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 21:03:08', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
INSERT IGNORE INTO relusergroupproperties (usergroupid, propertyid, propertyvalue, theorder)
                SELECT -1,propertyid , 0,0
                from properties;
INSERT IGNORE INTO usergroupadmin (propertyid, isallowed)
                SELECT propertyid , propertydefault
                from properties;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:40:59";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:10:59", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2023-02-07 22:10:59', '5', '', '41.233.139.178', '', 'DESKTOP');
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 < "2023-02-07 18:40:59";
DROP PROCEDURE IF EXISTS clientInUse;;

CREATE PROCEDURE clientInUse(IN id INT,OUT debtis VARCHAR(256),OUT nameis VARCHAR(256))
BEGIN
DECLARE in_use_flag INT DEFAULT 1;
SELECT inUse FROM client WHERE clientid = id INTO in_use_flag;

    IF in_use_flag = 0 THEN
        update client set inUse=1 where clientid = id;
        SELECT clientdebt,clientname INTO debtis,nameis FROM client WHERE clientid = id ;
    ELSE
        SELECT "in_use","in_use" INTO debtis,nameis;
    END IF;

END

;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:01";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:01", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 22:11:01', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:06";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:06", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:11:06', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:11";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:11", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 22:11:11', '5', 'addsellBill', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:13";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:13", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 22:11:13', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:23";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:23", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 22:11:23', '5', 'add', '41.233.139.178', '', 'DESKTOP');
BEGIN;
INSERT INTO expenses (expensestypeid, expensesname, expensesdetails, expensesValue, expensesdate, userid, conditions,costcenterid,saveid,dailyentryid,bankid,bankaccountid,checknum,productid) VALUES ('-1', 'محمد ممدوح نقدي', '', '200', '2023-02-07', '5', '0','-1','3','0','0','0','','0');
UPDATE save SET  savecurrentvalue = '3495',  userid = '5' WHERE saveid = '3';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('3695.00','200', '1', '3', 'إضافة مصروف', '2583', '3495', '2023-02-07 22:11:24', '5',  'expensesController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '200', '200', '2023-02-07', '5', '0', '0', '2023-02-07 22:11:24','اضافة اسم مصروف( محمد ممدوح نقدي )','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6143', '160', '200', '','0');
UPDATE accountstree SET name = '', customName = '', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2021-12-01', itemtype2 = '1', theValue = '-1094830', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '160';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6143', '137', '200', '','0');
UPDATE accountstree SET name = 'خزينة رائد', customName = 'خزينة رائد', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-832165', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '137';
UPDATE expenses SET expensestypeid = '-1', expensesname = 'محمد ممدوح نقدي', expensesdetails = '', expensesValue = '200.00', expensesdate = '2023-02-07', userid = '5', conditions = '0',saveid = '3' , dailyentryid = '6143', bankid = '0', bankaccountid = '0', checknum = '', productid = '0' WHERE expensesid = '2583';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:24";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:24", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 22:11:24', '5', 'sucess', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:26";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:26", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('expensesController.php', '2023-02-07 22:11:26', '5', 'show', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:32";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:32", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:11:32', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:41:54";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:11:54", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:11:54', '5', 'showDetail', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:44:19";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:14:19", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:14:19', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:44:45";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:14:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:14:45', '5', 'showDetail', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 18:45:08";
UPDATE user SET loginip = "41.233.139.178", lastactivetime = "2023-02-07 22:15:09", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:15:09', '5', '', '41.233.139.178', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:01";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:01", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('supplierPayedDeptController.php', '2023-02-07 22:31:01', '7', '', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:18";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:18", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('supplierPayedDeptController.php', '2023-02-07 22:31:18', '7', 'add', '197.192.205.142', '', 'DESKTOP');
BEGIN;
INSERT INTO supplierdebtchange (supplierid, supplierdebtchangebefore, supplierdebtchangeamount, supplierdebtchangetype, processname, supplierdebtchangemodelid, supplierdebtchangeafter, supplierdebtchangedate, userid, tablename, comment, dailyentryid,saveid, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor) VALUES ('1', '-1546751.00', '1500', '1', 'ايصال دفع لمورد', '423', '-1548251', '2023-02-07 22:31:01', '7', 'supplierPayedDeptController.php', 'جمعيه اودي', '0','5', '-1','1','1','1','1');
UPDATE supplier SET  suppliercurrentDebt = '-1548251', userid = '7', supplierdate = '2023-02-07 22:31:18'   WHERE supplierid = '1';
UPDATE save SET  savecurrentvalue = '135',  userid = '7' WHERE saveid = '5';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('1635.00','1500', '1', '5', 'ايصال دفع لمورد', '798', '135', '2023-02-07 22:31:18', '7',  'supplierPayedDeptController.php','0','');
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '1500', '1500', '2023-02-07', '7', '0', '0', '2023-02-07 22:31:19','ايصال دفع لمورد ( مباشر ) ','1','0','-1');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6144', '168', '1500', '','0');
UPDATE accountstree SET name = 'مباشر', customName = 'مباشر', parent = '10', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '7', mydate = '2021-12-11', itemtype2 = '1', theValue = '-1548251', theOrder = '0', layingOrder = '',reportid = '2' WHERE id = '168';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('6144', '139', '1500', '','0');
UPDATE accountstree SET name = 'خزينة محل عبدالله', customName = 'خزينة محل عبدالله', parent = '20', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '1', mydate = '2022-07-06', itemtype2 = '1', theValue = '-1430099', theOrder = '0', layingOrder = '',reportid = '0' WHERE id = '139';
UPDATE supplierdebtchange SET supplierid = '1', supplierdebtchangebefore = '-1546751.00', supplierdebtchangeamount = '1500.00', supplierdebtchangetype = '1', processname = 'ايصال دفع لمورد', supplierdebtchangemodelid = '423', supplierdebtchangeafter = '-1548251.00', supplierdebtchangedate = '2023-02-07 22:31:01', userid = '7', tablename = 'supplierPayedDeptController.php', comment = 'جمعيه اودي', dailyentryid = '6144',saveid = '5',currencyId='1',conversionFactor='1',payedInCurrency='1',saveConversionFactor='1' WHERE supplierdebtchangeid = '798';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:19";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:19", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('supplierReportsController.php', '2023-02-07 22:31:19', '7', 'editprint', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:28";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:28", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:31:28', '7', '', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:32";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:32", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2023-02-07 22:31:32', '7', 'showDetail', '197.192.205.142', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2023-02-07 19:01:36";
UPDATE user SET loginip = "197.192.205.142", lastactivetime = "2023-02-07 22:31:36", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2023-02-07 22:31:36', '7', 'addsellBill', '197.192.205.142', '', 'DESKTOP');
