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 < "2021-11-17 06:31:01";
UPDATE user SET loginip = "156.201.15.232", lastactivetime = "2021-11-17 10:01:01", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 10:01:01', '3', '', '156.201.15.232', '', '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 = '1', 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 = '2021-11-17',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 < "2021-11-17 06:31:01";
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 < "2021-11-17 06:31:07";
UPDATE user SET loginip = "156.201.15.232", lastactivetime = "2021-11-17 10:01:07", deviceType = "DESKTOP" WHERE userid = 3;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 10:01:07', '3', 'addsellBill', '156.201.15.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 < "2021-11-17 07:18:09";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:48:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 10:48:10', '1', '', '197.56.125.105', '', '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 < "2021-11-17 07:18:10";
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 < "2021-11-17 07:18:29";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:48:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 10:48:29', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:18:46";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:48:46", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 10:48:46', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:21:27";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:51:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 10:51:28', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:22:29";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:52:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 10:52:29', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:23:19";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:53:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 10:53:19', '1', 'add', '197.56.125.105', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('قطيفة هايدي810','','1','220','225', '255','235', '2021-11-17', '0', '1', '0', '', '0', '0', '0', '0', '0', '220','220','220','220','220','0','2.27','6.82','15.91','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'قطيفة هايدي810', productDescription = '', productCatId = '1', productBuyPrice = '220', productSellAllPrice = '225', productSellUnitPrice = '255', productSellHalfPrice = '235', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00560',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '220',lastbuyprice_withDiscount = '220',meanbuyprice = '220',meanbuyprice_withDiscount = '220' , productbuypricereal = '220' , buypricereal_precentage = '0' , buytotal_precentage = '2.27' , buyhalf_precentage = '6.82' , buypart_precentage = '15.91',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '560';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '560', '1', '2021-11-17', '1', '0','0056001','225','235','255','220');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('560', '1', '23', '1', '2021-11-17');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('560', '1', '23', '0', '560', 'إضافة منتج', 'productController.php', '0', '23', '1', '2021-11-17','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (560, 1,'2021-11-17 10:53:19',1)
                ON DUPLICATE KEY UPDATE productid = 560, edited = 1, sysdate = '2021-11-17 10:53:19', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '5060', '5060', '2021-11-17', '1', '0', '0', '2021-11-17 10:53:19','إضافة منتج قطيفة هايدي810 الكمية 23','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('654', '19', '5060', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '5614635', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('654', '7', '5060', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '6469580.8', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'قطيفة هايدي810', productDescription = '', productCatId = '1', productBuyPrice = '220.00', productSellAllPrice = '225.00', productSellUnitPrice = '255.00', productSellHalfPrice = '235.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00560',type ='0', expireDate = '0' , dailyentryId = '654',isService = '0',isOptic = '0',lastbuyprice = '220',lastbuyprice_withDiscount = '220',meanbuyprice = '220',meanbuyprice_withDiscount = '220' , productbuypricereal = '220' , buypricereal_precentage = '0' , buytotal_precentage = '2.27' , buyhalf_precentage = '6.82' , buypart_precentage = '15.91',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '560';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:23:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:53:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 10:53:21', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:23:25";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:53:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 10:53:25', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:23:40";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:53:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 10:53:40', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:23:51";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 10:53:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 10:53:51', '1', 'addsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:34:18";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:04:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 11:04:18', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 07:59:49";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:29:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 11:29:49', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:00:01";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:30:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 11:30:01', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:00:10";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:30:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 11:30:10', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:00:32";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:30:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 11:30:32', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:01:07";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:31:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2021-11-17 11:31:07', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:01:18";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:31:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 11:31:18', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:01:33";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:31:33", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 11:31:33', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:01:43";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:31:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 11:31:43', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:02:03";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:32:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 11:32:03', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:02:30";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:32:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 11:32:31', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:02:55";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:32:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 11:32:55', '1', '', '197.56.125.105', '', '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 < "2021-11-17 08:05:44";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:35:44", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 11:35:44', '4', '', '41.36.14.242', '', '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 < "2021-11-17 08:05: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 < "2021-11-17 08:05:48";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:35:49", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:35:49', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:06:11";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:36:11", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:36:11', '4', 'addAndRetuen', '41.36.14.242', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06194ccf542516
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, 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 ('2021-11-17 11:35:49', '06194ccf542516', '1', '0.00', '0', '0', '1', '190', '190', '190', '0', '7', '2021-11-17 11:36:11', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '1' ,'0','','','','','-1','0','0','0','0','0','190','0','','0','0','190','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','13', '0', '2021-11-17 11:36:11', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '190', '0', null, '0', null, null,'', '0','1','1','0','1');
UPDATE buypriceshistorybook set sellQuantity = sellQuantity+1 where id = 1486;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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','00385', '13', '1', '385', '1', '190', '190', '0', '', '0', '2021-11-17 11:36:11', '385', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','1486-1,');
UPDATE sellbilldetail SET  lastbuyprice = 185.00 , meanbuyprice = 185.00, lastbuyprice_withDiscount = 185.00, meanbuyprice_withDiscount = 185.00
                where sellbilldetailid = 27;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (385, '2021-11-17', 190, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 1, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , 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 (7, '2021-11-17', 190, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , 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 = '4', storedetaildate = '2021-11-17 11:36:11' WHERE storedetailid = '1294';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('385', '7', '1', '1', '13', 'اضافة فاتورة مبيعات', 'sellbillController.php', '13.00', '12', '4', '2021-11-17 11:36:11','0','0');
UPDATE save SET  savecurrentvalue = '5420',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5230.00','190', '0', '7', 'اضافة فاتورة مبيعات', '13', '5420', '2021-11-17 11:36:11', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-17', 190, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , 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, '2021-11-17', 190, 185, 185
                    , 185, 185, 185, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+190, sellCostBuyPrice =sellCostBuyPrice+185
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+185, sellCostMeanBuyPrice = sellCostMeanBuyPrice+185
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+185, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+185
                            , 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, 190, 185, 185
                    , 185, 185, 185, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+190, netSellCostBuyPrice = netSellCostBuyPrice+185
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+185
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+185
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+185
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+185
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06194ccf542516 and sellbillId = 13 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:06:12";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:36:12", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:36:12', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:06:21";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:36:21", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:36:21', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:07:02";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 11:37:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('userController.php', '2021-11-17 11:37:02', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:07:18";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:37:18", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:37:18', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:07:37";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:37:37", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:37:37', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:07:39";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:37:39", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:37:40', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:08:13";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:38:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:38:13', '4', 'addAndRetuen', '41.36.14.242', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06194cd641f33f
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO sellbill (sellbilldate, sellbillserial, sellbillclientid, sellbilltotaldeptbefor, sellbilltotaldeptafter, sellbilldiscount, sellbilldiscounttype, sellbilltotalbill, sellbillaftertotalbill, sellbilltotalpayed, sellbillfinalbill, sellbillstoreid, sellbillsysdate,comment, userid, conditions, sellbillclientname, sellbillsaveid, sellbildirectpayment, billnameid, sellerid, tempclientName, sellQuantity,tax ,carnumber, 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 ('2021-11-17 11:37:40', '06194cd641f33f', '1', '0.00', '0', '0', '1', '440', '440', '440', '0', '7', '2021-11-17 11:38:13', '', '4', '0', 'نقدي', '7', '0', '3', '0', 'نقدي', '2' ,'0','','','','','-1','0','0','0','0','0','440','0','','0','0','440','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','0','اضافة فاتورة مبيعات','14', '0', '2021-11-17 11:38:13', '4', 'sellbillController.php', 'اضافة فاتورة مبيعات', '440', '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 ('210','00465', '14', '1', '465', '2', '220.00', '440', '0', '', '0', '2021-11-17 11:38:13', '465', '0.00', '0', '7','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 28;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (465, '2021-11-17', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 2, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , 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 (7, '2021-11-17', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , 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 = '14', userid = '4', storedetaildate = '2021-11-17 11:38:13' WHERE storedetailid = '1467';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '7', '2', '1', '14', 'اضافة فاتورة مبيعات', 'sellbillController.php', '16.00', '14', '4', '2021-11-17 11:38:13','0','0');
UPDATE save SET  savecurrentvalue = '5860',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5420.00','440', '0', '7', 'اضافة فاتورة مبيعات', '14', '5860', '2021-11-17 11:38:13', '4',  'sellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-17', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , 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, '2021-11-17', 440, 420, 420
                    , 420, 420, 420, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+440, sellCostBuyPrice =sellCostBuyPrice+420
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+420, sellCostMeanBuyPrice = sellCostMeanBuyPrice+420
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+420, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+420
                            , 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, 440, 420, 420
                    , 420, 420, 420, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+440, netSellCostBuyPrice = netSellCostBuyPrice+420
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+420
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+420
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+420
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+420
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06194cd641f33f and sellbillId = 14 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:08:13";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:38:13", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:38:13', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:09:01";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:39:01", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:39:01', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:09:17";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:39:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:39:17', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:10:06";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:40:06", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:40:06', '4', 'addAndRetuen', '41.36.14.242', '', 'DESKTOP');

-- ----------------------------------------------------------------------------------------------------
-- bill add start - with serial 06194cdc5b58b3
-- ----------------------------------------------------------------------------------------------------

BEGIN;
INSERT INTO returnsellbill (returnsellbilldate, returnsellbillserial, returnsellbillclientid, returnsellbilltotaldeptbefor, returnsellbilltotaldeptafter, returnsellbilldiscount, returnsellbilldiscounttype, returnsellbilltotalbill, returnsellbillaftertotalbill, returnsellbilltotalpayed, returnsellbillfinalbill, returnsellbillstoreid, returnsellbillsysdate,comment, userid, conditions, returnsellbillclientname, returnsellbillsaveid, returnsellbildirectpayment, billnameid, sellerid, tempclientName, returnsellQuantity,tax, carnumber, cartype, carchase, carmotor,costcenterid,dailyentryid,delbyuserid,billReservation,billReservationDate,visaAccountId,cashPayed,visaPayed,isBankAccountTransfer,extraDiscountPer,extraDiscountVal,taxOfDiscountPer,taxOfDiscountVal) VALUES ('2021-11-17 11:39:17', '06194cdc5b58b3', '1', '0.00', '0', '0', '1', '330', '330', '-330', '0', '7', '2021-11-17 11:40:07', '', '4', '0', 'نقدي','7', '0', '5', '0', 'نقدي', '2', '0', '', '','','','-1','0','0','0','','0','-330','0','0','0','0','0','0');
UPDATE client SET  clientdebt = '0', userid = '4' WHERE clientid = '1';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('1','0.00','0','1','اضافة فاتورة مردوات مبيعات','4', '0', '2021-11-17 11:40:07', '4', 'returnsellbillController.php', 'اضافة فاتورة مردوات مبيعات', '330', '0', null, '0', null, null,'', '0','1','1','0','1');
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 ('125.00', '00379', '4', '1', '379', '2', '165', '330', '0', '', '1', '0', '379', '0.00', '0','7','0','','','0','0','0','0','0','1');
UPDATE returnsellbilldetail SET  lastbuyprice = 125.00 , meanbuyprice = 125.00, lastbuyprice_withDiscount = 125.00, meanbuyprice_withDiscount = 125.00
                where returnsellbilldetailid = 5;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (379, '2021-11-17', 0, 0, 0
                    , 0, 0, 0, 0
                    , 330, 250, 250, 250
                    , 250, 250, 0, 0, 2)
                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+330, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+0
                        , netQuantityRet = netQuantityRet+2;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (7, '2021-11-17', 0, 0, 0
                    , 0, 0, 0, 0
                    , 330, 250, 250, 250
                    , 250, 250, 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+330, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
UPDATE storedetail SET  productquantity = '52', userid = '4', storedetaildate = '2021-11-17 11:40:07' WHERE storedetailid = '1279';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('379', '7', '2', '0', '4', 'اضافة فاتورة مردودات مبيعات', 'returnsellbillController.php', '50.00', '52', '4', '2021-11-17 11:40:07','0','0');
UPDATE save SET  savecurrentvalue = '5530',  userid = '4' WHERE saveid = '7';
INSERT INTO savedaily (savedailysavebefore, savedailychangeamount, savedailychangetype, saveid, processname, savedailymodelid, savedailysaveafter, savedailydate, userid, tablename,clientid ,note) VALUES ('5860.00','330', '1', '7', 'اضافة فاتورة مردوات مبيعات', '4', '5530', '2021-11-17 11:40:07', '4',  'returnsellbillController.php','1','');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-17', 0, 0, 0
                    , 0, 0, 0, 0
                    , 330, 250, 250, 250
                    , 250, 250, 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+330, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitclient (clientId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 0, 0, 0
                    , 0, 0, 0, 0
                    , 330, 250, 250, 250
                    , 250, 250, 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+330, returnSellCostBuyPrice = returnSellCostBuyPrice+250, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+250
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+250, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+250
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+250
                        , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0;
 INSERT INTO quickprofitgeneral (id, netSellVal, netSellCostBuyPrice, netSellCostLastBuyPrice, netSellCostMeanBuyPrice, netSellCostLastBuyPricewithDiscount, netSellCostMeanBuyPricewithDiscount, netSellCostOverAllAveragePrice)
                    VALUES (1, -330, -250, -250
                    , -250, -250, -250, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+-330, netSellCostBuyPrice = netSellCostBuyPrice+-250
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+-250
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+-250
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+-250
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+-250
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06194cdc5b58b3 and sellbillId = 4 and returnsellbillId = 4
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:10:07";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:40:07", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 11:40:07', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 08:10:17";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 11:40:17", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-17 11:40:17', '4', '', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:07:55";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:37:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2021-11-17 12:37:55', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:08:18";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:38:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2021-11-17 12:38:18', '1', 'add', '197.56.125.105', '', 'DESKTOP');
INSERT INTO client (clientname, clientaddress, clientphone, clientmobile, clientdebt, clientdetails, conditions, clientdate, userid,clientareaid,clientcode,dailyentryid ,rondomtxt,clientStoreIds,obygyPatientId,debtLimit,typeclientid,priceTypeId,card_number,file_faida,specialDiscount,specialDiscountVal,file,addDate,mandobCollectRatio,webApiId,clientRFID,linkedSupplierId,postponeDays,studentid) VALUES ('لشيخ وليد خاص' , '', '', '', '0', '', '0', '2021-11-17 12:38:19', '1', '0','','0','','-10','0','10000',',-20,','-1','0','','0','0','.','2021-11-17','0','0','','0','0','0');
INSERT INTO tamweenclientdetail (clientid, noOfPersonsTamween, noOfPersonsDa3m, cardNum, cardPassword) VALUES ('85', '0', '0', '', '');
INSERT INTO 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 ('85','0','0','0','إضافة عميل جديد','85', '0', '2021-11-17 12:38:19', '0', 'clientController.php', '', '0', '0', null, '0', null, null,'', '0','1','1','0','1');
INSERT INTO accountstree (name, customName, parent, itemtype, itemfrom, notes, del, userid, mydate, itemtype2, theValue, theOrder, layingOrder,reportid) VALUES ('لشيخ وليد خاص', 'لشيخ وليد خاص', '23', '3', '0', '', '0', '1', '2021-11-17', '1', '0', '0', '','2');
UPDATE client SET clientname = 'لشيخ وليد خاص', clientaddress = '', clientphone = '', clientmobile = '', clientdebt = '0.00', clientdetails = '', conditions = '0', clientdate = '2021-11-17', userid = '1'  , clientareaid = '0'  ,clientcode = '',dailyentryid = '0' , rondomtxt = '',clientStoreIds = '-10', obygyPatientId = '0' , debtLimit='10000' , typeclientid=',-20,',priceTypeId='-1',lastEditUser = '0',card_number = '0',file_faida = '',specialDiscount = '0',specialDiscountVal = '0',file = '.',mandobCollectRatio='0',clientRFID = '',linkedSupplierId = '0',postponeDays='0', studentid='0' WHERE clientid = '85';
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:08:19";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:38:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2021-11-17 12:38:19', '1', 'sucess', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:08:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:38:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientController.php', '2021-11-17 12:38:21', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:09:49";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:39:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 12:39:49', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:10:49";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:40:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:40:49', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:12:06";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:42:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:42:06', '1', 'add', '197.56.125.105', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('كريشة شتوي806','','1','210','210', '210','210', '2021-11-17', '0', '1', '0', '', '0', '0', '0', '0', '0', '210','210','210','210','210','0','0','0','0','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210', productSellAllPrice = '210', productSellUnitPrice = '210', productSellHalfPrice = '210', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210',lastbuyprice_withDiscount = '210',meanbuyprice = '210',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '561';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '561', '1', '2021-11-17', '1', '0','0056101','210','210','210','210');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('561', '1', '0', '1', '2021-11-17');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '1', '0', '0', '561', 'إضافة منتج', 'productController.php', '0', '0', '1', '2021-11-17','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (561, 1,'2021-11-17 12:42:07',1)
                ON DUPLICATE KEY UPDATE productid = 561, edited = 1, sysdate = '2021-11-17 12:42:07', userid = 1;
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210.00', productSellAllPrice = '210.00', productSellUnitPrice = '210.00', productSellHalfPrice = '210.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210',lastbuyprice_withDiscount = '210',meanbuyprice = '210',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '561';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:12:08";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:42:08", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:42:08', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:12:11";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:42:11", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:42:11', '1', 'addsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:12:58";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:42:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 12:42:58', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:13:10";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:43:10", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 12:43:10', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:13:22";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:43:22", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('settlementstoreController.php', '2021-11-17 12:43:22', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:13:26";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:43:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:43:27', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:13:37";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:43:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:43:37', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:13:52";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:43:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 12:43:52', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:14:12";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:44:12", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 12:44:12', '1', 'add', '197.56.125.105', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '15', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '1480';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '1', '15', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '15', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:14:14";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:44:14", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 12:44:14', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:14:16";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:44:16", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:44:16', '1', 'addsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:14:57";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:44:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:44:57', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:15:07";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:45:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:45:07', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210.00', productSellAllPrice = '220.00', productSellUnitPrice = '220.00', productSellHalfPrice = '220.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210.00',lastbuyprice_withDiscount = '210',meanbuyprice = '210.00',meanbuyprice_withDiscount = '210' , productbuypricereal = '210.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '561';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (561, 1,'2021-11-17 12:45:16',1)
                ON DUPLICATE KEY UPDATE productid = 561, edited = 1, sysdate = '2021-11-17 12:45:16', userid = 1;
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210.00', productSellAllPrice = '220.00', productSellUnitPrice = '220.00', productSellHalfPrice = '230.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210.00',lastbuyprice_withDiscount = '210',meanbuyprice = '210.00',meanbuyprice_withDiscount = '210' , productbuypricereal = '210.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '561';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (561, 1,'2021-11-17 12:45:22',1)
                ON DUPLICATE KEY UPDATE productid = 561, edited = 1, sysdate = '2021-11-17 12:45:22', userid = 1;
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210.00', productSellAllPrice = '220.00', productSellUnitPrice = '250.00', productSellHalfPrice = '230.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210.00',lastbuyprice_withDiscount = '210',meanbuyprice = '210.00',meanbuyprice_withDiscount = '210' , productbuypricereal = '210.00' , buypricereal_precentage = '0.00' , buytotal_precentage = '0.00' , buyhalf_precentage = '0.00' , buypart_precentage = '0.00',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '561';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (561, 1,'2021-11-17 12:45:27',1)
                ON DUPLICATE KEY UPDATE productid = 561, edited = 1, sysdate = '2021-11-17 12:45:27', userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:15:27";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:45:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:45:27', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:15:34";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:45:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:45:34', '1', 'update', '197.56.125.105', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 561;
UPDATE productunit SET unitid = '1', productid = '561', productnumber = '1.00', productunitdate = '2021-11-17', userid = '1', conditions = '0',proUnitParcode='0056101',proUnitSellAllPrice='210',proUnitSellHalfPrice='210',proUnitSellUnitPrice ='210',proUnitBuyPrice='210' WHERE productunitid = '561';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (561, 1,'2021-11-17 12:45:34',1)
                ON DUPLICATE KEY UPDATE productid = 561, edited = 1, sysdate = '2021-11-17 12:45:34', userid = 1;
UPDATE product SET productName = 'كريشة شتوي806', productDescription = '', productCatId = '1', productBuyPrice = '210', productSellAllPrice = '220', productSellUnitPrice = '250', productSellHalfPrice = '230', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00561',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210.00',lastbuyprice_withDiscount = '210',meanbuyprice = '210.00',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '561';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:15:36";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:45:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:45:36', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:15:38";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:45:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:45:38', '1', 'addsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:17:19";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:47:19", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:47:19', '1', 'addAndRetuen', '197.56.125.105', '', '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 06194dd53202da
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(85,@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 ('2021-11-17 12:45:39', '06194dd53202da', '85', '0.00', '8040', '0', '1', '8040', '8040', '0', '8040', '1', '2021-11-17 12:47:19', '', '1', '0', 'لشيخ وليد خاص', '1', '1', '3', '0', 'لشيخ وليد خاص', '36' ,'0','','','','','-1','0','0','0','0','0','8040','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '8040', userid = '1' WHERE clientid = '85';
INSERT INTO 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 ('85','0.00','8040','0','اضافة فاتورة مبيعات','15', '8040', '2021-11-17 12:47:19', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '8040', '0', null, '0', null, null,'', '0','1','1','8040','1');
UPDATE client SET  inUse = 0 where clientid = 85;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('210','00561', '15', '1', '561', '6', '220', '1320', '0', '', '0', '2021-11-17 12:47:19', '561', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 29;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (561, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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 = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '1480';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('561', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '15.00', '9', '1', '2021-11-17 12:47:19','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 ('195','00555', '15', '1', '555', '6', '230', '1380', '0', '', '0', '2021-11-17 12:47:19', '555', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 195.00 , meanbuyprice = 195.00, lastbuyprice_withDiscount = 195.00, meanbuyprice_withDiscount = 195.00
                where sellbilldetailid = 30;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (555, '2021-11-17', 1380, 1170, 1170
                    , 1170, 1170, 1170, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1170
                            , 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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1380, 1170, 1170
                    , 1170, 1170, 1170, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1380, sellCostBuyPrice =sellCostBuyPrice+1170
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1170, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1170
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1170, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1170
                            , 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 = '92', userid = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '1468';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('555', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '98.00', '92', '1', '2021-11-17 12:47:19','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 ('240','00466', '15', '1', '466', '6', '250', '1500', '0', '', '0', '2021-11-17 12:47:19', '466', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 240.00 , meanbuyprice = 240.00, lastbuyprice_withDiscount = 240.00, meanbuyprice_withDiscount = 240.00
                where sellbilldetailid = 31;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (466, '2021-11-17', 1500, 1440, 1440
                    , 1440, 1440, 1440, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+0
                        , returnSellVal = returnSellVal+0, returnSellCostBuyPrice = returnSellCostBuyPrice+0, returnSellCostLastBuyPrice = returnSellCostLastBuyPrice+0
                        , returnSellCostMeanBuyPrice = returnSellCostMeanBuyPrice+0, returnSellCostLastBuyPricewithDiscount = returnSellCostLastBuyPricewithDiscount+0
                        , returnSellCostMeanBuyPricewithDiscount = returnSellCostMeanBuyPricewithDiscount+0
                            , returnSellCostOverAllAveragePrice = returnSellCostOverAllAveragePrice+0
                        , netQuantity = netQuantity+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1500, 1440, 1440
                    , 1440, 1440, 1440, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1500, sellCostBuyPrice =sellCostBuyPrice+1440
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1440, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1440
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1440, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1440
                            , sellCostOverAllAveragePrice = sellCostOverAllAveragePrice+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 = '-6', userid = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0.00', '-6', '1', '2021-11-17 12:47:19','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 ('210','00465', '15', '1', '465', '6', '220', '1320', '0', '', '0', '2021-11-17 12:47:19', '465', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 32;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (465, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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 = '-24', userid = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '465';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('465', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '-18.00', '-24', '1', '2021-11-17 12:47:19','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 ('210','00518', '15', '1', '518', '6', '220', '1320', '0', '', '0', '2021-11-17 12:47:19', '518', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 210.00 , meanbuyprice = 210.00, lastbuyprice_withDiscount = 210.00, meanbuyprice_withDiscount = 210.00
                where sellbilldetailid = 33;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (518, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1320, 1260, 1260
                    , 1260, 1260, 1260, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1320, sellCostBuyPrice =sellCostBuyPrice+1260
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1260, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1260
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1260, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1260
                            , 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 = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '518';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('518', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '19.00', '13', '1', '2021-11-17 12:47:19','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 ('190','00392', '15', '1', '392', '6', '200', '1200', '0', '', '0', '2021-11-17 12:47:19', '392', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 190.00 , meanbuyprice = 190.00, lastbuyprice_withDiscount = 190.00, meanbuyprice_withDiscount = 190.00
                where sellbilldetailid = 34;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (392, '2021-11-17', 1200, 1140, 1140
                    , 1140, 1140, 1140, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 6, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , 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+6
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 1200, 1140, 1140
                    , 1140, 1140, 1140, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+1200, sellCostBuyPrice =sellCostBuyPrice+1140
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+1140, sellCostMeanBuyPrice = sellCostMeanBuyPrice+1140
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+1140, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+1140
                            , 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 = '-6', userid = '1', storedetaildate = '2021-11-17 12:47:19' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '6', '1', '15', 'اضافة فاتورة مبيعات', 'sellbillController.php', '0.00', '-6', '1', '2021-11-17 12:47:19','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-17', 8040, 7530, 7530
                    , 7530, 7530, 7530, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8040, sellCostBuyPrice =sellCostBuyPrice+7530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7530
                            , 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 (85, '2021-11-17', 8040, 7530, 7530
                    , 7530, 7530, 7530, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+8040, sellCostBuyPrice =sellCostBuyPrice+7530
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+7530, sellCostMeanBuyPrice = sellCostMeanBuyPrice+7530
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+7530, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+7530
                            , 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, 8040, 7530, 7530
                    , 7530, 7530, 7530, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+8040, netSellCostBuyPrice = netSellCostBuyPrice+7530
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+7530
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+7530
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+7530
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+7530
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 06194dd53202da and sellbillId = 15 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:17:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:47:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:47:21', '1', 'addsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:17:35";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:47:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 12:47:35', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:17:47";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:47:47", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 12:47:47', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:18:03";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:48:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('billsettingsController.php', '2021-11-17 12:48:03', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:18:29";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:48:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('billsettingsController.php', '2021-11-17 12:48:29', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:19:07";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:49:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:49:07', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:19:17";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:49:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:49:18', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:19:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:49:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:49:21', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:19:43";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:49:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:49:43', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:19:48";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:49:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 12:49:48', '1', 'editsellBill', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:22:20";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:52:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 12:52:20', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:22:38";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:52:38", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:52:38', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:26:30";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:56:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:56:30', '1', 'add', '197.56.125.105', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('زنط فرنساوي 819','','1','225','230', '260','240', '2021-11-17', '0', '1', '0', '', '0', '0', '0', '0', '0', '225','225','225','225','225','0','2.22','6.67','15.56','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'زنط فرنساوي 819', productDescription = '', productCatId = '1', productBuyPrice = '225', productSellAllPrice = '230', productSellUnitPrice = '260', productSellHalfPrice = '240', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00562',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '225',lastbuyprice_withDiscount = '225',meanbuyprice = '225',meanbuyprice_withDiscount = '225' , productbuypricereal = '225' , buypricereal_precentage = '0' , buytotal_precentage = '2.22' , buyhalf_precentage = '6.67' , buypart_precentage = '15.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '562';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '562', '1', '2021-11-17', '1', '0','0056201','230','240','260','225');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('562', '1', '172', '1', '2021-11-17');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '1', '172', '0', '562', 'إضافة منتج', 'productController.php', '0', '172', '1', '2021-11-17','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (562, 1,'2021-11-17 12:56:31',1)
                ON DUPLICATE KEY UPDATE productid = 562, edited = 1, sysdate = '2021-11-17 12:56:31', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '38700', '38700', '2021-11-17', '1', '0', '0', '2021-11-17 12:56:31','إضافة منتج زنط فرنساوي 819 الكمية 172','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('655', '19', '38700', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '5653335', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('655', '7', '38700', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '6508280.8', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'زنط فرنساوي 819', productDescription = '', productCatId = '1', productBuyPrice = '225.00', productSellAllPrice = '230.00', productSellUnitPrice = '260.00', productSellHalfPrice = '240.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00562',type ='0', expireDate = '0' , dailyentryId = '655',isService = '0',isOptic = '0',lastbuyprice = '225',lastbuyprice_withDiscount = '225',meanbuyprice = '225',meanbuyprice_withDiscount = '225' , productbuypricereal = '225' , buypricereal_precentage = '0' , buytotal_precentage = '2.22' , buyhalf_precentage = '6.67' , buypart_precentage = '15.56',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '562';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:26:32";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:56:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 12:56:32', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:29:24";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 12:59:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 12:59:24', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:30:18";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:00:18", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 13:00:18', '1', 'add', '197.56.125.105', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '222', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '1481';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('562', '1', '50', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '172.00', '222', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:30:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:00:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 13:00:21', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:37:35";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:07:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productCatController.php', '2021-11-17 13:07:35', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:37:41";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:07:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productCatController.php', '2021-11-17 13:07:41', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:37:52";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:07:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storeController.php', '2021-11-17 13:07:52', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:38:24";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:08:24", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:08:25', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:38:49";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:08:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:08:49', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:39:29";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:09:29", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:09:29', '1', 'add', '197.56.125.105', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('811','','1','210','220', '250','230', '2021-11-17', '0', '1', '0', '', '0', '0', '0', '0', '0', '210','210','210','210','210','0','4.76','9.52','19.05','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = '811', productDescription = '', productCatId = '1', productBuyPrice = '210', productSellAllPrice = '220', productSellUnitPrice = '250', productSellHalfPrice = '230', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00563',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210',lastbuyprice_withDiscount = '210',meanbuyprice = '210',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '4.76' , buyhalf_precentage = '9.52' , buypart_precentage = '19.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '563';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '563', '1', '2021-11-17', '1', '0','0056301','220','230','250','210');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('563', '1', '0', '1', '2021-11-17');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '1', '0', '0', '563', 'إضافة منتج', 'productController.php', '0', '0', '1', '2021-11-17','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (563, 1,'2021-11-17 13:09:29',1)
                ON DUPLICATE KEY UPDATE productid = 563, edited = 1, sysdate = '2021-11-17 13:09:29', userid = 1;
UPDATE product SET productName = '811', productDescription = '', productCatId = '1', productBuyPrice = '210.00', productSellAllPrice = '220.00', productSellUnitPrice = '250.00', productSellHalfPrice = '230.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00563',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '210',lastbuyprice_withDiscount = '210',meanbuyprice = '210',meanbuyprice_withDiscount = '210' , productbuypricereal = '210' , buypricereal_precentage = '0' , buytotal_precentage = '4.76' , buyhalf_precentage = '9.52' , buypart_precentage = '19.05',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '563';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:39:31";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:09:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:09:31', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:40:17";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:10:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:10:17', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:40:39";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:10:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:10:39', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:41:13";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:11:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:11:13', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:41:21";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:11:21", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:11:21', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:41:50";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:11:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:11:50', '1', 'update', '197.56.125.105', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 214;
UPDATE productunit SET unitid = '1', productid = '214', productnumber = '1.00', productunitdate = '2021-11-17', userid = '1', conditions = '0',proUnitParcode='0021401',proUnitSellAllPrice='220',proUnitSellHalfPrice='235',proUnitSellUnitPrice ='250',proUnitBuyPrice='205' WHERE productunitid = '214';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (214, 1,'2021-11-17 13:11:50',1)
                ON DUPLICATE KEY UPDATE productid = 214, edited = 1, sysdate = '2021-11-17 13:11:50', userid = 1;
UPDATE product SET productName = ' قطيفه 813', productDescription = '', productCatId = '1', productBuyPrice = '205', productSellAllPrice = '250', productSellUnitPrice = '280', productSellHalfPrice = '260', productDate = '2021-11-07', conditions = '0', userId = '1', limitamount = '0', parcode = '00214',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '205.00',lastbuyprice_withDiscount = '205',meanbuyprice = '205.00',meanbuyprice_withDiscount = '205' , productbuypricereal = '0' , buypricereal_precentage = '0' , buytotal_precentage = '21.95' , buyhalf_precentage = '26.83' , buypart_precentage = '36.59',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '214';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:41:52";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:11:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:11:52', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:42:09";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:12:09", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:12:09', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:42:42";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:12:42", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:12:42', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:42:48";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:12:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:12:48', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:43:15";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:13:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 13:13:15', '1', '', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:43:44";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:13:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:13:44', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:43:57";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:13:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:13:57', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:44:00";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:14:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:14:00', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:44:23";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:14:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:14:23', '1', 'update', '197.56.125.105', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 58;
UPDATE productunit SET unitid = '1', productid = '58', productnumber = '1.00', productunitdate = '2021-11-17', userid = '1', conditions = '0',proUnitParcode='0005801',proUnitSellAllPrice='165',proUnitSellHalfPrice='175',proUnitSellUnitPrice ='195',proUnitBuyPrice='155' WHERE productunitid = '58';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (58, 1,'2021-11-17 13:14:23',1)
                ON DUPLICATE KEY UPDATE productid = 58, edited = 1, sysdate = '2021-11-17 13:14:23', userid = 1;
UPDATE product SET productName = '350', productDescription = '', productCatId = '1', productBuyPrice = '155', productSellAllPrice = '280', productSellUnitPrice = '310', productSellHalfPrice = '290', productDate = '2021-11-07', conditions = '0', userId = '1', limitamount = '0', parcode = '00058',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '155.00',lastbuyprice_withDiscount = '155',meanbuyprice = '155.00',meanbuyprice_withDiscount = '155' , productbuypricereal = '0' , buypricereal_precentage = '0' , buytotal_precentage = '80.65' , buyhalf_precentage = '87.1' , buypart_precentage = '100',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '58';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:44:25";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:14:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:14:25', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:44:48";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:14:48", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:14:48', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:44:55";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:14:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:14:55', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:45:15";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:15:15", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:15:15', '1', 'update', '197.56.125.105', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 255;
UPDATE productunit SET unitid = '1', productid = '255', productnumber = '1.00', productunitdate = '2021-11-17', userid = '1', conditions = '0',proUnitParcode='0025501',proUnitSellAllPrice='285',proUnitSellHalfPrice='285',proUnitSellUnitPrice ='310',proUnitBuyPrice='255' WHERE productunitid = '255';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (255, 1,'2021-11-17 13:15:15',1)
                ON DUPLICATE KEY UPDATE productid = 255, edited = 1, sysdate = '2021-11-17 13:15:15', userid = 1;
UPDATE product SET productName = '3036 نواره الشام', productDescription = '', productCatId = '1', productBuyPrice = '255', productSellAllPrice = '265', productSellUnitPrice = '295', productSellHalfPrice = '275', productDate = '2021-11-07', conditions = '0', userId = '1', limitamount = '0', parcode = '00255',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '255.00',lastbuyprice_withDiscount = '255',meanbuyprice = '255.00',meanbuyprice_withDiscount = '255' , productbuypricereal = '0' , buypricereal_precentage = '0' , buytotal_precentage = '3.92' , buyhalf_precentage = '7.84' , buypart_precentage = '15.69',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '255';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:45:17";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:15:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:15:17', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:45:41";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:15:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:15:41', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:46:04";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:16:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:16:05', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:46:25";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:16:25", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:16:25', '1', 'show', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:46:40";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:16:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:16:40', '1', 'edit', '197.56.125.105', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:47:00";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:17:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:17:00', '1', 'update', '197.56.125.105', '', 'DESKTOP');
BEGIN;
UPDATE productunit SET  conditions = 1 WHERE productunitid = 302;
UPDATE productunit SET unitid = '1', productid = '302', productnumber = '1.00', productunitdate = '2021-11-17', userid = '1', conditions = '0',proUnitParcode='0030201',proUnitSellAllPrice='210',proUnitSellHalfPrice='220',proUnitSellUnitPrice ='250',proUnitBuyPrice='200' WHERE productunitid = '302';
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (302, 1,'2021-11-17 13:17:00',1)
                ON DUPLICATE KEY UPDATE productid = 302, edited = 1, sysdate = '2021-11-17 13:17:00', userid = 1;
UPDATE product SET productName = '809شتوي', productDescription = '', productCatId = '1', productBuyPrice = '200', productSellAllPrice = '200', productSellUnitPrice = '230', productSellHalfPrice = '210', productDate = '2021-11-07', conditions = '0', userId = '1', limitamount = '0', parcode = '00302',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '200.00',lastbuyprice_withDiscount = '200',meanbuyprice = '200.00',meanbuyprice_withDiscount = '200' , productbuypricereal = '0' , buypricereal_precentage = '0' , buytotal_precentage = '0' , buyhalf_precentage = '5' , buypart_precentage = '15',logo = '',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType ='0' , online = '' , updatebyuser = '0'  WHERE productId = '302';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 09:47:02";
UPDATE user SET loginip = "197.56.125.105", lastactivetime = "2021-11-17 13:17:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 13:17:02', '1', 'show', '197.56.125.105', '', '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 < "2021-11-17 10:48:20";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:18:20", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 14:18:20', '1', '', '197.56.148.190', '', '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 < "2021-11-17 10:48: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 < "2021-11-17 10:48:35";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:18:35", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:18:35', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:49:31";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:19:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:19:31', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '99', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '392';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('392', '1', '105', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '-6.00', '99', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:49:33";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:19:34", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:19:34', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:49:36";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:19:36", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:19:36', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:50:01";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:20:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:20:01', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '24', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '391';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('391', '1', '24', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '24', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:50:03";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:20:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:20:03', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:50:17";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:20:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 14:20:17', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:50:31";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:20:31", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 14:20:31', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:50:52";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:20:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 14:20:52', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:51:23";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:21:23", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 14:21:23', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:51:52";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:21:52", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2021-11-17 14:21:52', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:52:13";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:22:13", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2021-11-17 14:22:13', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:52:27";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:22:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:22:27', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:53:01";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:23:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:23:01', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '34', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '-6.00', '28', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:53:03";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:23:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:23:03', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:53:30";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:23:30", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:23:30', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '50', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '466';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('466', '1', '22', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '28.00', '50', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:53:32";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:23:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:23:32', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:54:02";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:24:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:24:02', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '27', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '402';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('402', '1', '27', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '27', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:54:04";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:24:04", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:24:04', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:54:43";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:24:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:24:43', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '54', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '1482';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('563', '1', '54', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '54', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:54:44";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:24:45", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:24:45', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:56:05";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:26:05", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:26:05', '1', 'add', '197.56.148.190', '', 'DESKTOP');
UPDATE storedetail SET  productquantity = '28', userid = '1', storedetaildate = '2021-11-17' WHERE storedetailid = '464';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('464', '1', '28', '0', '-1', 'تم إعادة جرد المنتج بالقيمة الحالية بالزيادة', 'inventoryController.php', '0.00', '28', '1', '2021-11-17','0','0');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:56:07";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:26:07", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('inventoryController.php', '2021-11-17 14:26:07', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:56:39";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:26:40", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 14:26:40', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:59:06";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:29:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('salesNumbersReport.php', '2021-11-17 14:29:06', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:59:32";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:29:32", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2021-11-17 14:29:32', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 10:59:53";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:29:53", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storereportController.php', '2021-11-17 14:29:53', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 11:00:37";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:30:37", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productmovmentController.php', '2021-11-17 14:30:37', '1', '', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 11:00:44";
UPDATE user SET loginip = "197.56.148.190", lastactivetime = "2021-11-17 14:30:44", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productmovmentController.php', '2021-11-17 14:30:44', '1', 'show', '197.56.148.190', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 11:12:09";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 14:42:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 14:42:09', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 11:12:09";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 14:42:09", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 14:42:09', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 11:12:20";
UPDATE user SET loginip = "41.36.14.242", lastactivetime = "2021-11-17 14:42:20", deviceType = "DESKTOP" WHERE userid = 4;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 14:42:20', '4', 'addsellBill', '41.36.14.242', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 3;
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 < "2021-11-17 13:01:35";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:31:35", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 16:31:35', '7', '', '156.160.188.87', '', '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 < "2021-11-17 13:01:36";
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 < "2021-11-17 13:01:43";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:31:43", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 16:31:44', '7', 'addsellBill', '156.160.188.87', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 13:02:03";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:32:03", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-17 16:32:03', '7', '', '156.160.188.87', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 13:02:04";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:32:04", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('savedailyController.php', '2021-11-17 16:32:04', '7', '', '156.160.188.87', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 13:02:08";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:32:08", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 16:32:08', '7', 'addsellBill', '156.160.188.87', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 13:02:09";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:32:09", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 16:32:09', '7', 'addsellBill', '156.160.188.87', '', '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 < "2021-11-17 13:12:12";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:42:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 16:42:13', '7', '', '156.160.188.87', '', '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 < "2021-11-17 13:12:13";
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 < "2021-11-17 13:12:13";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:42:13", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 16:42:13', '7', '', '156.160.188.87', '', '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 < "2021-11-17 13:12:14";
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 < "2021-11-17 13:12:22";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:42:22", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 16:42:23', '7', 'addsellBill', '156.160.188.87', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 13:12:23";
UPDATE user SET loginip = "156.160.188.87", lastactivetime = "2021-11-17 16:42:23", deviceType = "DESKTOP" WHERE userid = 7;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 16:42:23', '7', 'addsellBill', '156.160.188.87', '', '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 < "2021-11-17 13:23:28";
UPDATE user SET loginip = "197.56.83.121", lastactivetime = "2021-11-17 16:53:28", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 16:53:28', '1', '', '197.56.83.121', '', '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 < "2021-11-17 13:23:28";
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;
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 < "2021-11-17 15:20:37";
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 < "2021-11-17 15:20:45";
UPDATE user SET loginip = "154.180.88.192", lastactivetime = "2021-11-17 18:50:45", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 18:50:45', '5', '', '154.180.88.192', '', '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 < "2021-11-17 15:20: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 < "2021-11-17 15:20:52";
UPDATE user SET loginip = "154.180.88.192", lastactivetime = "2021-11-17 18:50:52", deviceType = "DESKTOP" WHERE userid = 5;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 18:50:52', '5', 'addsellBill', '154.180.88.192', '', '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 < "2021-11-17 15:23:01";
UPDATE user SET loginip = "197.56.83.121", lastactivetime = "2021-11-17 18:53:01", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 18:53:01', '1', '', '197.56.83.121', '', '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 < "2021-11-17 15:23:01";
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 userid = 7;
UPDATE user SET loginip = "" WHERE userid = 5;
UPDATE user SET loginip = "" WHERE userid = 1;
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 < "2021-11-17 16:33:41";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 20:03:41", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('index.php', '2021-11-17 20:03:41', '1', '', '197.56.127.36', '', '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 < "2021-11-17 16:33:42";
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 < "2021-11-17 17:11:17";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 20:41:17", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 20:41:17', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 17:11:27";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 20:41:27", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 20:41:27', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 17:11:43";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 20:41:43", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('storedetailController.php', '2021-11-17 20:41:43', '1', 'show', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 17:27:39";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 20:57:39", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 20:57:39', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:11:26";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:41:26", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 21:41:26', '1', 'addsellBill', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:12:02";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:42:02", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 21:42:02', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:12:55";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:42:55", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 21:42:55', '1', 'add', '197.56.127.36', '', 'DESKTOP');
BEGIN;
INSERT INTO product (productName, productDescription, productCatId, productBuyPrice, productSellAllPrice, productSellUnitPrice, productSellHalfPrice, productDate, conditions, userId, limitamount, parcode,type, expireDate, dailyentryId,isService,isOptic,lastbuyprice,lastbuyprice_withDiscount,meanbuyprice,meanbuyprice_withDiscount , productbuypricereal , buypricereal_precentage , buytotal_precentage , buyhalf_precentage , buypart_precentage,logo,inMenu,obygyDetectionId,hasSizeAndColor,overAllAveragePrice,reviewType,online,updatebyuser,proExcelid,proExcelParcode,webApiId) VALUES ('قماش قطيفة هايدي','','2','95','98', '98','98', '2021-11-17', '0', '1', '0', '', '0', '0', '0', '0', '0', '95','95','95','95','95','0','3.16','0','0','.','0','0','0','0','0','','','0','0','0');
UPDATE product SET productName = 'قماش قطيفة هايدي', productDescription = '', productCatId = '2', productBuyPrice = '95', productSellAllPrice = '98', productSellUnitPrice = '98', productSellHalfPrice = '98', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00564',type ='0', expireDate = '0' , dailyentryId = '0',isService = '0',isOptic = '0',lastbuyprice = '95',lastbuyprice_withDiscount = '95',meanbuyprice = '95',meanbuyprice_withDiscount = '95' , productbuypricereal = '95' , buypricereal_precentage = '0' , buytotal_precentage = '3.16' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '564';
INSERT INTO productunit (unitid, productid, productnumber, productunitdate, userid, conditions,proUnitParcode,proUnitSellAllPrice,proUnitSellHalfPrice,proUnitSellUnitPrice,proUnitBuyPrice) VALUES ('1', '564', '1', '2021-11-17', '1', '0','0056401','98','98','98','95');
INSERT INTO storedetail (productid, storeid, productquantity, userid, storedetaildate) VALUES ('564', '1', '210.500', '1', '2021-11-17');
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('564', '1', '210.500', '0', '564', 'إضافة منتج', 'productController.php', '0', '210.500', '1', '2021-11-17','0','0');
INSERT INTO onlinetempproduct (productid, edited, sysdate, userid)
                VALUES (564, 1,'2021-11-17 21:42:55',1)
                ON DUPLICATE KEY UPDATE productid = 564, edited = 1, sysdate = '2021-11-17 21:42:55', userid = 1;
INSERT INTO dailyentry (totalcreditor, totaldebtor, thedate, userid, `condition`, reverseofid, dDateTime,entryComment,fromFlag,related,branchid) VALUES ( '19997.5', '19997.5', '2021-11-17', '1', '0', '0', '2021-11-17 21:42:55','إضافة منتج قماش قطيفة هايدي الكمية 210.500','1','0','0');
INSERT INTO dailyentrydebtor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('656', '19', '19997.5', '','0');
UPDATE accountstree SET name = 'البضاعة (بضاعة أول المدة)', customName = 'البضاعة (بضاعة أول المدة)', parent = '6', itemtype = '3', itemfrom = '0', notes = '', del = '0', userid = '0', mydate = '0000-00-00', itemtype2 = '1', theValue = '5673332.5', theOrder = '0', layingOrder = '121',reportid = '0' WHERE id = '19';
INSERT INTO dailyentrycreditor (dailyentryid, accountstreeid, value, dComment,costcenterid) VALUES ('656', '7', '19997.5', '','0');
UPDATE accountstree SET name = 'رأس المال', customName = 'رأس المال', parent = '25', itemtype = '1', itemfrom = '0', notes = '', del = '0', userid = '2', mydate = '2016-11-23', itemtype2 = '1', theValue = '6528278.3', theOrder = '0', layingOrder = '211',reportid = '0' WHERE id = '7';
UPDATE product SET productName = 'قماش قطيفة هايدي', productDescription = '', productCatId = '2', productBuyPrice = '95.00', productSellAllPrice = '98.00', productSellUnitPrice = '98.00', productSellHalfPrice = '98.00', productDate = '2021-11-17', conditions = '0', userId = '1', limitamount = '0', parcode = '00564',type ='0', expireDate = '0' , dailyentryId = '656',isService = '0',isOptic = '0',lastbuyprice = '95',lastbuyprice_withDiscount = '95',meanbuyprice = '95',meanbuyprice_withDiscount = '95' , productbuypricereal = '95' , buypricereal_precentage = '0' , buytotal_precentage = '3.16' , buyhalf_precentage = '0' , buypart_precentage = '0',logo = '.',inMenu='0', obygyDetectionId = '0',hasSizeAndColor = '0',logo1 = '',logo2 = '',logo3 = '',logo4 = '',logo5 = '',logo6 = '',logo7 = '',reviewType =null , online = '' , updatebyuser = ''  WHERE productId = '564';
COMMIT;
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:12:57";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:42:57", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('productController.php', '2021-11-17 21:42:57', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:13:00";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:43:00", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 21:43:00', '1', 'addsellBill', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:14:50";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:44:50", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 21:44:50', '1', 'addAndRetuen', '197.56.127.36', '', '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 061955b4451fcc
-- ----------------------------------------------------------------------------------------------------

BEGIN;
CALL clientInUse(15,@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 ('2021-11-17 21:43:00', '061955b4451fcc', '15', '24793.00', '45422', '0', '1', '20629', '20629', '0', '20629', '1', '2021-11-17 21:44:51', '', '1', '0', 'حمادة العرينى', '1', '1', '3', '0', 'حمادة العرينى', '210.5' ,'0','','','','','-1','0','0','0','0','0','20629','0','','0','0','0','0','0','0','0','0','0','0','0','');
UPDATE client SET  clientdebt = '45422', userid = '1' WHERE clientid = '15';
INSERT INTO clientdebtchange (clientid, clientdebtchangebefore, clientdebtchangeamount, clientdebtchangetype, processname, clientdebtchangemodelid, clientdebtchangeafter, clientdebtchangedate, userid, tablename, comment, totalOperationCost,discount,reciptid,dailyentryid , num , billid , paytype, costcenterid,currencyId,conversionFactor,payedInCurrency,saveConversionFactor ) VALUES ('15','24793.00','20629','0','اضافة فاتورة مبيعات','16', '45422', '2021-11-17 21:44:51', '1', 'sellbillController.php', 'اضافة فاتورة مبيعات', '20629', '0', null, '0', null, null,'', '0','1','1','20629','1');
UPDATE client SET  inUse = 0 where clientid = 15;
INSERT INTO sellbilldetail (buyprice, parcode, sellbillid, sellbilldetailcatid, sellbilldetailproductid, sellbilldetailquantity, sellbilldetailprice, 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 ('95','00564', '16', '2', '564', '210.500', '98', '20629', '0', '', '0', '2021-11-17 21:44:51', '564', '0.00', '0', '1','0','','','0','0','0','0','0','0','0','0','','');
UPDATE sellbilldetail SET  lastbuyprice = 95.00 , meanbuyprice = 95.00, lastbuyprice_withDiscount = 95.00, meanbuyprice_withDiscount = 95.00
                where sellbilldetailid = 35;
 INSERT INTO quickprofitproduct (productId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice,netQuantity,netQuantityRet)
                    VALUES (564, '2021-11-17', 20629, 19997.5, 19997.5
                    , 19997.5, 19997.5, 19997.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0, 210.5, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20629, sellCostBuyPrice =sellCostBuyPrice+19997.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19997.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19997.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19997.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19997.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+210.5
                        , netQuantityRet = netQuantityRet+0;
 INSERT INTO quickprofitstore (storeId, theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount, returnSellCostOverAllAveragePrice)
                    VALUES (1, '2021-11-17', 20629, 19997.5, 19997.5
                    , 19997.5, 19997.5, 19997.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20629, sellCostBuyPrice =sellCostBuyPrice+19997.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19997.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19997.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19997.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19997.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 = '0', userid = '1', storedetaildate = '2021-11-17 21:44:51' WHERE storedetailid = '1483';
INSERT INTO storereport (productid, storeid, productquantity, storereporttype, storereportmodelid, processname, tablename, productbefore, productafter, userid, storereportdate,sizeid,colorid) VALUES ('564', '1', '210.5', '1', '16', 'اضافة فاتورة مبيعات', 'sellbillController.php', '210.50', '0', '1', '2021-11-17 21:44:51','0','0');
 INSERT INTO quickprofitday (theDate, sellVal, sellCostBuyPrice, sellCostLastBuyPrice, sellCostMeanBuyPrice, sellCostLastBuyPricewithDiscount, sellCostMeanBuyPricewithDiscount, sellCostOverAllAveragePrice, returnSellVal, returnSellCostBuyPrice, returnSellCostLastBuyPrice, returnSellCostMeanBuyPrice, returnSellCostLastBuyPricewithDiscount, returnSellCostMeanBuyPricewithDiscount,returnSellCostOverAllAveragePrice)
                    VALUES ('2021-11-17', 20629, 19997.5, 19997.5
                    , 19997.5, 19997.5, 19997.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20629, sellCostBuyPrice =sellCostBuyPrice+19997.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19997.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19997.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19997.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19997.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 (15, '2021-11-17', 20629, 19997.5, 19997.5
                    , 19997.5, 19997.5, 19997.5, 0
                    , 0, 0, 0, 0
                    , 0, 0, 0)
                ON DUPLICATE KEY UPDATE sellVal = sellVal+20629, sellCostBuyPrice =sellCostBuyPrice+19997.5
                        , sellCostLastBuyPrice = sellCostLastBuyPrice+19997.5, sellCostMeanBuyPrice = sellCostMeanBuyPrice+19997.5
                        , sellCostLastBuyPricewithDiscount = sellCostLastBuyPricewithDiscount+19997.5, sellCostMeanBuyPricewithDiscount = sellCostMeanBuyPricewithDiscount+19997.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, 20629, 19997.5, 19997.5
                    , 19997.5, 19997.5, 19997.5, 0)
                ON DUPLICATE KEY UPDATE netSellVal = netSellVal+20629, netSellCostBuyPrice = netSellCostBuyPrice+19997.5
                , netSellCostLastBuyPrice = netSellCostLastBuyPrice+19997.5
                , netSellCostMeanBuyPrice = netSellCostMeanBuyPrice+19997.5
                , netSellCostLastBuyPricewithDiscount = netSellCostLastBuyPricewithDiscount+19997.5
                , netSellCostMeanBuyPricewithDiscount = netSellCostMeanBuyPricewithDiscount+19997.5
                , netSellCostOverAllAveragePrice = netSellCostOverAllAveragePrice+0;
COMMIT;

-- ----------------------------------------------------------------------------------------------------
-- bill add end - with serial 061955b4451fcc and sellbillId = 16 and returnsellbillId = 
-- ----------------------------------------------------------------------------------------------------

UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:14:51";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:44:51", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('sellbillController.php', '2021-11-17 21:44:51', '1', 'addsellBill', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:14:58";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:44:58", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 21:44:58', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:15:06";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:45:06", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 21:45:06', '1', 'show', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:28:49";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:58:49", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 21:58:49', '1', '', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE lastactivetime < "2021-11-17 18:29:03";
UPDATE user SET loginip = "197.56.127.36", lastactivetime = "2021-11-17 21:59:03", deviceType = "DESKTOP" WHERE userid = 1;
INSERT INTO movementmanage (operationname, movementmanagedate, userid, currentDo, ip, mac, deviceType) VALUES ('clientReportsController.php', '2021-11-17 21:59:03', '1', 'show', '197.56.127.36', '', 'DESKTOP');
UPDATE user SET loginip = "" WHERE userid = 1;
